{"version":3,"file":"index-35c3ec96.js","sources":["../../src/utils/theme.ts","../../src/initTheme.ts","../../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.production.min.js","../../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.js","../../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react-jsx-runtime.production.min.js","../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js","../../../node_modules/.pnpm/scheduler@0.23.0/node_modules/scheduler/cjs/scheduler.production.min.js","../../../node_modules/.pnpm/scheduler@0.23.0/node_modules/scheduler/index.js","../../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.production.min.js","../../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/index.js","../../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/client.js","../../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/index.js","../../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/utils/batch.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/components/Context.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/hooks/useReduxContext.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/utils/useSyncExternalStore.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/hooks/useSelector.js","../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js","../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js","../../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../../node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/cjs/react-is.production.min.js","../../../node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/index.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/utils/Subscription.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/utils/useIsomorphicLayoutEffect.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/utils/shallowEqual.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/components/Provider.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/hooks/useStore.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/hooks/useDispatch.js","../../../node_modules/.pnpm/react-redux@8.1.2_@types+react-dom@18.0.11_@types+react@18.0.35_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/index.js","../../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.es6.js","../../../node_modules/.pnpm/@formatjs+ecma402-abstract@1.14.3/node_modules/@formatjs/ecma402-abstract/lib/utils.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.3.1/node_modules/@formatjs/icu-messageformat-parser/lib/error.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.3.1/node_modules/@formatjs/icu-messageformat-parser/lib/types.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.3.1/node_modules/@formatjs/icu-messageformat-parser/lib/regex.generated.js","../../../node_modules/.pnpm/@formatjs+icu-skeleton-parser@1.3.18/node_modules/@formatjs/icu-skeleton-parser/lib/date-time.js","../../../node_modules/.pnpm/@formatjs+icu-skeleton-parser@1.3.18/node_modules/@formatjs/icu-skeleton-parser/lib/regex.generated.js","../../../node_modules/.pnpm/@formatjs+icu-skeleton-parser@1.3.18/node_modules/@formatjs/icu-skeleton-parser/lib/number.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.3.1/node_modules/@formatjs/icu-messageformat-parser/lib/time-data.generated.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.3.1/node_modules/@formatjs/icu-messageformat-parser/lib/date-time-pattern-generator.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.3.1/node_modules/@formatjs/icu-messageformat-parser/lib/parser.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.3.1/node_modules/@formatjs/icu-messageformat-parser/lib/index.js","../../../node_modules/.pnpm/@formatjs+fast-memoize@2.0.1/node_modules/@formatjs/fast-memoize/lib/index.js","../../../node_modules/.pnpm/intl-messageformat@10.3.4/node_modules/intl-messageformat/lib/src/error.js","../../../node_modules/.pnpm/intl-messageformat@10.3.4/node_modules/intl-messageformat/lib/src/formatters.js","../../../node_modules/.pnpm/intl-messageformat@10.3.4/node_modules/intl-messageformat/lib/src/core.js","../../../node_modules/.pnpm/@formatjs+intl@2.7.0_typescript@5.0.4/node_modules/@formatjs/intl/lib/src/error.js","../../../node_modules/.pnpm/@formatjs+intl@2.7.0_typescript@5.0.4/node_modules/@formatjs/intl/lib/src/utils.js","../../../node_modules/.pnpm/@formatjs+intl@2.7.0_typescript@5.0.4/node_modules/@formatjs/intl/lib/src/message.js","../../../node_modules/.pnpm/@formatjs+intl@2.7.0_typescript@5.0.4/node_modules/@formatjs/intl/lib/src/dateTime.js","../../../node_modules/.pnpm/@formatjs+intl@2.7.0_typescript@5.0.4/node_modules/@formatjs/intl/lib/src/displayName.js","../../../node_modules/.pnpm/@formatjs+intl@2.7.0_typescript@5.0.4/node_modules/@formatjs/intl/lib/src/list.js","../../../node_modules/.pnpm/@formatjs+intl@2.7.0_typescript@5.0.4/node_modules/@formatjs/intl/lib/src/plural.js","../../../node_modules/.pnpm/@formatjs+intl@2.7.0_typescript@5.0.4/node_modules/@formatjs/intl/lib/src/relativeTime.js","../../../node_modules/.pnpm/@formatjs+intl@2.7.0_typescript@5.0.4/node_modules/@formatjs/intl/lib/src/number.js","../../../node_modules/.pnpm/@formatjs+intl@2.7.0_typescript@5.0.4/node_modules/@formatjs/intl/lib/src/create-intl.js","../../../node_modules/.pnpm/react-intl@6.4.0_react@18.2.0_typescript@5.0.4/node_modules/react-intl/lib/src/utils.js","../../../node_modules/.pnpm/react-intl@6.4.0_react@18.2.0_typescript@5.0.4/node_modules/react-intl/lib/src/components/injectIntl.js","../../../node_modules/.pnpm/react-intl@6.4.0_react@18.2.0_typescript@5.0.4/node_modules/react-intl/lib/src/components/useIntl.js","../../../node_modules/.pnpm/react-intl@6.4.0_react@18.2.0_typescript@5.0.4/node_modules/react-intl/lib/src/components/createFormattedComponent.js","../../../node_modules/.pnpm/react-intl@6.4.0_react@18.2.0_typescript@5.0.4/node_modules/react-intl/lib/src/components/provider.js","../../../node_modules/.pnpm/react-intl@6.4.0_react@18.2.0_typescript@5.0.4/node_modules/react-intl/lib/src/components/message.js","../../../node_modules/.pnpm/react-intl@6.4.0_react@18.2.0_typescript@5.0.4/node_modules/react-intl/lib/index.js","../../src/components/sgwt/AccountCenter.tsx","../../src/components/bootstrap/Switcher.tsx","../../src/helpers/app-routes.ts","../../../node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js","../../../node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js","../../../node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js","../../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/utils.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/Navbar.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/NavbarBrand.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/Nav.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/NavItem.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/CloseButton.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/Button.js","../../../node_modules/.pnpm/react-popper@2.3.0_@popperjs+core@2.11.8_react-dom@18.2.0_react@18.2.0/node_modules/react-popper/lib/esm/Manager.js","../../../node_modules/.pnpm/react-popper@2.3.0_@popperjs+core@2.11.8_react-dom@18.2.0_react@18.2.0/node_modules/react-popper/lib/esm/utils.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/enums.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/math.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/userAgent.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/contains.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/within.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/arrow.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getVariation.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/flip.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/hide.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/offset.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/debounce.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/mergeByName.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/createPopper.js","../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/popper.js","../../../node_modules/.pnpm/react-fast-compare@3.2.2/node_modules/react-fast-compare/index.js","../../../node_modules/.pnpm/react-popper@2.3.0_@popperjs+core@2.11.8_react-dom@18.2.0_react@18.2.0/node_modules/react-popper/lib/esm/usePopper.js","../../../node_modules/.pnpm/react-popper@2.3.0_@popperjs+core@2.11.8_react-dom@18.2.0_react@18.2.0/node_modules/react-popper/lib/esm/Popper.js","../../../node_modules/.pnpm/react-popper@2.3.0_@popperjs+core@2.11.8_react-dom@18.2.0_react@18.2.0/node_modules/react-popper/lib/esm/Reference.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/DropdownContext.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/InputGroupContext.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/Dropdown.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/DropdownItem.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/DropdownMenu.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/DropdownToggle.js","../../../node_modules/.pnpm/reactstrap@9.2.0_react-dom@18.2.0_react@18.2.0/node_modules/reactstrap/esm/UncontrolledDropdown.js","../../../node_modules/.pnpm/@remix-run+router@1.8.0/node_modules/@remix-run/router/dist/router.js","../../../node_modules/.pnpm/react-router@6.15.0_react@18.2.0/node_modules/react-router/dist/index.js","../../../node_modules/.pnpm/react-router-dom@6.15.0_react-dom@18.2.0_react@18.2.0/node_modules/react-router-dom/dist/index.js","../../src/components/layout/Header.tsx","../../src/config/config.ts","../../src/components/sgwt/HelpCenter.tsx","../../src/components/sgwt/MiniFooter.tsx","../../src/components/layout/Footer.tsx","../../src/components/App.tsx","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectErrorList.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectError.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectEventList.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectAuthorizationUri.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/isScopeListed.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/normalizeUrl.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectServerResponse.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectRedirectUri.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectConfiguration.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectStorage.js","../../../node_modules/.pnpm/events@3.0.0/node_modules/events/events.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/isSameOrigin.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/isObject.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectOpenIDUserInfo.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectCore.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectHash.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectIdTokenClaims.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectNoop.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/SGWTConnectOpenIDMetadata.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/src/setupSGWTConnect.js","../../../node_modules/.pnpm/@sgwt+connect-core@0.17.1/node_modules/@sgwt/connect-core/dist/index.js","../../src/widgets/sgwtConnect.ts","../../src/widgets/widgets.ts","../../src/context/IntlContext.tsx","../../src/components/routes/TradeBlotter/TradeBlotter.tsx","../../../node_modules/.pnpm/stylis@4.3.0/node_modules/stylis/src/Enum.js","../../../node_modules/.pnpm/stylis@4.3.0/node_modules/stylis/src/Utility.js","../../../node_modules/.pnpm/stylis@4.3.0/node_modules/stylis/src/Tokenizer.js","../../../node_modules/.pnpm/stylis@4.3.0/node_modules/stylis/src/Parser.js","../../../node_modules/.pnpm/stylis@4.3.0/node_modules/stylis/src/Prefixer.js","../../../node_modules/.pnpm/stylis@4.3.0/node_modules/stylis/src/Serializer.js","../../../node_modules/.pnpm/stylis@4.3.0/node_modules/stylis/src/Middleware.js","../../../node_modules/.pnpm/@emotion+unitless@0.8.1/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js","../../../node_modules/.pnpm/styled-components@6.0.7_react-dom@18.2.0_react@18.2.0/node_modules/styled-components/dist/styled-components.browser.esm.js","../../../node_modules/.pnpm/immer@9.0.21/node_modules/immer/dist/immer.esm.mjs","../../../node_modules/.pnpm/@babel+runtime@7.21.0/node_modules/@babel/runtime/helpers/esm/typeof.js","../../../node_modules/.pnpm/@babel+runtime@7.21.0/node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../../../node_modules/.pnpm/@babel+runtime@7.21.0/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../../../node_modules/.pnpm/@babel+runtime@7.21.0/node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../../node_modules/.pnpm/@babel+runtime@7.21.0/node_modules/@babel/runtime/helpers/esm/objectSpread2.js","../../../node_modules/.pnpm/redux@4.2.1/node_modules/redux/es/redux.js","../../../node_modules/.pnpm/reselect@4.1.8/node_modules/reselect/es/defaultMemoize.js","../../../node_modules/.pnpm/reselect@4.1.8/node_modules/reselect/es/index.js","../../../node_modules/.pnpm/redux-thunk@2.4.2_redux@4.2.1/node_modules/redux-thunk/es/index.js","../../../node_modules/.pnpm/@reduxjs+toolkit@1.9.5_react-redux@8.1.2_react@18.2.0/node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js","../../../node_modules/.pnpm/@reduxjs+toolkit@1.9.5_react-redux@8.1.2_react@18.2.0/node_modules/@reduxjs/toolkit/dist/query/rtk-query.esm.js","../../../node_modules/.pnpm/@reduxjs+toolkit@1.9.5_react-redux@8.1.2_react@18.2.0/node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.esm.js","../../src/store/apiUtils.ts","../../src/store/tradeReportingApi.ts","../../src/components/routes/StockReconciliation/StockReconciliationFilter.tsx","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/generic.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/columns/columnKeyCreator.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/object.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/function.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/modules/moduleNames.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/modules/moduleRegistry.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/context/context.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/eventService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/entities/column.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/entities/providedColumnGroup.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/entities/defaultColumnTypes.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/array.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/event.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/context/beanStub.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/columns/columnFactory.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/entities/columnGroup.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/eventKeys.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/columns/groupInstanceIdCreator.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/columns/autoGroupColService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/string.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/map.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/components/colDefUtil.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/propertyKeys.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/components/componentUtil.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/fuzzyMatch.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridOptionsValidator.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/columns/columnModel.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/columns/columnUtils.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/columns/displayedGroupCreator.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/components/agStackComponentsRegistry.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/aria.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/browser.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/number.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/date.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/dom.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/icon.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/constants/keyCode.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/keyboard.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/mouse.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/rowNode.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/set.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/utils.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/numberSequence.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/promise.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/customTooltipFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cssClassManager.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/component.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/componentAnnotations.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/floating/provided/readOnlyFloatingFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/date/dateCompWrapper.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/optionsFactory.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/filterLocaleText.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/managedFocusFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/features/positionableFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/providedFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agAbstractLabel.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agAbstractField.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agPickerField.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agList.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agSelect.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agAbstractInputField.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agCheckbox.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agRadioButton.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/simpleFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/scalarFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/date/dateFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/floating/provided/simpleFloatingFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/date/dateFloatingFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/date/defaultDateComponent.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agInputTextField.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agInputNumberField.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/number/numberFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/text/textFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/floating/provided/textInputFloatingFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/number/numberFloatingFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/provided/text/textFloatingFilter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/touchListener.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/column/sortIndicatorComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/column/headerComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/columnGroup/headerGroupComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/popupComponent.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellEditors/largeTextCellEditor.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellEditors/selectCellEditor.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellEditors/simpleCellEditor.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellEditors/textCellEditor.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellRenderers/animateShowChangeCellRenderer.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellRenderers/animateSlideCellRenderer.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/entities/rowNode.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/checkboxSelectionComponent.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/dragAndDrop/dragAndDropService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/row/rowDragComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellRenderers/groupCellRendererCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellRenderers/groupCellRenderer.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellRenderers/loadingCellRenderer.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/overlays/loadingOverlayComponent.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/overlays/noRowsOverlayComponent.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/tooltipComponent.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellEditors/numberCellEditor.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellEditors/dateCellEditor.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellEditors/dateStringCellEditor.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellRenderers/checkboxCellRenderer.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellEditors/checkboxCellEditor.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/components/framework/userComponentRegistry.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/components/framework/componentTypes.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/floating/floatingFilterMapper.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/components/framework/userComponentFactory.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/interfaces/iExcelCreator.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/dragAndDrop/dragService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/interfaces/iRowNode.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/interfaces/iClientSideRowModel.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridApi.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/filter/filterManager.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/abstractCell/abstractHeaderCellComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/floatingFilter/headerFilterCellComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/styling/layoutFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/gridBodyScrollFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/autoScrollService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/rowDragFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/gridBodyCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/interfaces/IRangeService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cell/cellRangeFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cell/cellPositionFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cell/cellCustomStyleFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/tooltipFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/beans.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cell/cellMouseListenerFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cell/cellKeyboardListenerFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/dndSourceComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cell/cellCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/row/rowCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/rowContainer/rowContainerEventsFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/viewportSizeFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/rowContainer/setPinnedLeftWidthFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/rowContainer/setPinnedRightWidthFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/rowContainer/setHeightFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/rowContainer/dragListenerFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/centerWidthFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/rowContainer/rowContainerCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/gridBodyComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/scrollVisibleService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/mouseEventService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/navigationService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cellEditors/popupEditorWrapper.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/cell/cellComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/row/rowComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/rowContainer/rowContainerComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/columnDrag/bodyDropPivotTarget.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/columnDrag/moveColumnFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/columnDrag/bodyDropTarget.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/cssClassApplier.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/column/headerCellComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/columnGroup/headerGroupCellComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/row/headerRowComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/abstractCell/abstractHeaderCellCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/features/setLeftFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/hoverFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/floatingFilter/headerFilterCellCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/column/resizeFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/column/selectAllFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/tabGuardCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/focusService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/column/headerCellCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/columnGroup/groupResizeFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/columnGroup/groupWidthFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/columnGroup/headerGroupCellCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/row/headerRowCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/rowContainer/headerRowContainerCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/rowContainer/headerRowContainerComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/common/headerNavigationService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/gridHeaderCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/gridHeaderComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/common/horizontalResizeService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/cells/column/standardMenu.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/layout/tabbedLayout.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/misc/resizeObserverService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/misc/animationFrameService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/autoWidthCalculator.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/features/stickyRowFeature.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/rowRenderer.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/valueFormatterService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/pinnedRowModel/pinnedRowModel.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/interfaces/serverSideTransaction.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/utils/changedPath.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rowNodeCache/rowNodeBlock.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rowNodeCache/rowNodeBlockLoader.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/pagination/paginationProxy.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/styling/stylingService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agToggleButton.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agInputTextArea.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agInputDateField.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agInputRange.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agRichSelectRow.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/tabGuardComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/virtualList.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agRichSelect.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agSlider.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agGroupComponent.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agMenuList.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agMenuPanel.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agMenuItemComponent.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agPanel.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agDialog.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/popupService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agAutocompleteRow.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agAutocompleteList.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/widgets/agAutocomplete.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/vanillaFrameworkOverrides.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/cellNavigationService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/alignedGridsService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/selectionService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/columns/columnApi.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/valueService/valueService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/valueService/expressionService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/templateService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/logger.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridComp/gridCtrl.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridComp/gridComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/sortController.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/columnHoverService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/columnAnimationService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/pagination/paginationAutoPageSizeService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/valueService/valueCache.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/valueService/changeDetectionService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/components/framework/agComponentUtils.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/components/framework/componentMetadataProvider.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/environment.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/rowContainerHeightService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rowNodes/selectableService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/pagination/paginationComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/overlays/overlayWrapperComponent.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/entities/rowPositionUtils.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/entities/cellPositionUtils.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/undoRedo/undoRedoStack.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/undoRedo/undoRedoService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/headerRendering/common/headerPosition.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/columns/columnDefFactory.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rendering/row/rowCssClassCalculator.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/rowNodes/rowNodeSorter.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/ctrlsService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/ctrlsFactory.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/abstractFakeScrollComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/fakeHScrollComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/pinnedWidthService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/entities/rowNodeEventThrottle.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridOptionsService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/localeService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/gridBodyComp/fakeVScrollComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/columns/dataTypeService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/valueService/valueParserService.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/grid.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/components/framework/frameworkComponentWrapper.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/interfaces/iSparklineCellRendererParams.mjs","../../../node_modules/.pnpm/@ag-grid-community+core@30.1.0/node_modules/@ag-grid-community/core/dist/esm/es6/main.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/shared/reactComponent.mjs","../../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js","../../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js","../../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/server.browser.js","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/shared/keyGenerator.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/legacy/legacyReactComponent.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/shared/newReactComponent.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/shared/portalManager.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/beansContext.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/jsComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/utils.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/cellRenderer/groupCellRenderer.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/header/headerCellComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/header/headerGroupCellComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/header/headerFilterCellComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/header/headerRowComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/header/headerRowContainerComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/header/gridHeaderComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/reactComment.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/useEffectOnce.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/cells/popupEditorComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/cells/showJsRenderer.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/cells/cellComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/rows/rowComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/rows/rowContainerComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/gridBodyComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/tabGuardComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/gridComp.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/agGridReactUi.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/reactUi/cellRenderer/detailCellRenderer.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/shared/reactFrameworkOverrides.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/legacy/agGridReactLegacy.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/agGridReact.mjs","../../../node_modules/.pnpm/@ag-grid-community+react@30.1.0_@ag-grid-community+core@30.1.0_react-dom@18.2.0_react@18.2.0/node_modules/@ag-grid-community/react/lib/shared/interfaces.mjs","../../../node_modules/.pnpm/@ag-grid-community+client-side-row-model@30.1.0/node_modules/@ag-grid-community/client-side-row-model/dist/esm/es6/clientSideRowModel/clientSideNodeManager.mjs","../../../node_modules/.pnpm/@ag-grid-community+client-side-row-model@30.1.0/node_modules/@ag-grid-community/client-side-row-model/dist/esm/es6/clientSideRowModel/clientSideRowModel.mjs","../../../node_modules/.pnpm/@ag-grid-community+client-side-row-model@30.1.0/node_modules/@ag-grid-community/client-side-row-model/dist/esm/es6/clientSideRowModel/filterStage.mjs","../../../node_modules/.pnpm/@ag-grid-community+client-side-row-model@30.1.0/node_modules/@ag-grid-community/client-side-row-model/dist/esm/es6/clientSideRowModel/sortStage.mjs","../../../node_modules/.pnpm/@ag-grid-community+client-side-row-model@30.1.0/node_modules/@ag-grid-community/client-side-row-model/dist/esm/es6/clientSideRowModel/flattenStage.mjs","../../../node_modules/.pnpm/@ag-grid-community+client-side-row-model@30.1.0/node_modules/@ag-grid-community/client-side-row-model/dist/esm/es6/clientSideRowModel/sortService.mjs","../../../node_modules/.pnpm/@ag-grid-community+client-side-row-model@30.1.0/node_modules/@ag-grid-community/client-side-row-model/dist/esm/es6/clientSideRowModel/filterService.mjs","../../../node_modules/.pnpm/@ag-grid-community+client-side-row-model@30.1.0/node_modules/@ag-grid-community/client-side-row-model/dist/esm/es6/clientSideRowModel/immutableService.mjs","../../../node_modules/.pnpm/@ag-grid-community+client-side-row-model@30.1.0/node_modules/@ag-grid-community/client-side-row-model/dist/esm/es6/version.mjs","../../../node_modules/.pnpm/@ag-grid-community+client-side-row-model@30.1.0/node_modules/@ag-grid-community/client-side-row-model/dist/esm/es6/clientSideRowModelModule.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+core@30.1.0/node_modules/@ag-grid-enterprise/core/dist/esm/es6/license/shared/md5.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+core@30.1.0/node_modules/@ag-grid-enterprise/core/dist/esm/es6/license/shared/licenseManager.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+core@30.1.0/node_modules/@ag-grid-enterprise/core/dist/esm/es6/license/gridLicenseManager.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+core@30.1.0/node_modules/@ag-grid-enterprise/core/dist/esm/es6/license/watermark.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+core@30.1.0/node_modules/@ag-grid-enterprise/core/dist/esm/es6/version.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+core@30.1.0/node_modules/@ag-grid-enterprise/core/dist/esm/es6/agGridEnterpriseModule.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnToolPanel/primaryColsHeaderPanel.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnToolPanel/columnModelItem.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnToolPanel/toolPanelContextMenu.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnToolPanel/toolPanelColumnGroupComp.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnToolPanel/primaryColsListPanelItemDragFeature.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnToolPanel/toolPanelColumnComp.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnToolPanel/primaryColsListPanel.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnToolPanel/pivotModePanel.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/aggregationStage.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/batchRemover.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/groupStage.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/pivotColDefService.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/pivotStage.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/aggFuncService.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/columnDropZones/dropZoneColumnComp.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/columnDropZones/baseDropZonePanel.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/columnDropZones/rowGroupDropZonePanel.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/columnDropZones/pivotDropZonePanel.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/columnDropZones/gridHeaderDropZones.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/filterAggregatesStage.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/version.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/groupFilter/groupFilter.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/groupFilter/groupFloatingFilter.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGroupingModule.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+row-grouping@30.1.0/node_modules/@ag-grid-enterprise/row-grouping/dist/esm/es6/rowGrouping/columnDropZones/valueDropZonePanel.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnToolPanel/primaryColsPanel.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnToolPanel/columnToolPanel.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+side-bar@30.1.0/node_modules/@ag-grid-enterprise/side-bar/dist/esm/es6/sideBar/horizontalResizeComp.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+side-bar@30.1.0/node_modules/@ag-grid-enterprise/side-bar/dist/esm/es6/sideBar/sideBarButtonComp.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+side-bar@30.1.0/node_modules/@ag-grid-enterprise/side-bar/dist/esm/es6/sideBar/sideBarButtonsComp.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+side-bar@30.1.0/node_modules/@ag-grid-enterprise/side-bar/dist/esm/es6/sideBar/sideBarDefParser.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+side-bar@30.1.0/node_modules/@ag-grid-enterprise/side-bar/dist/esm/es6/sideBar/toolPanelWrapper.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+side-bar@30.1.0/node_modules/@ag-grid-enterprise/side-bar/dist/esm/es6/sideBar/sideBarComp.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+side-bar@30.1.0/node_modules/@ag-grid-enterprise/side-bar/dist/esm/es6/sideBar/common/toolPanelColDefService.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+side-bar@30.1.0/node_modules/@ag-grid-enterprise/side-bar/dist/esm/es6/version.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+side-bar@30.1.0/node_modules/@ag-grid-enterprise/side-bar/dist/esm/es6/sideBarModule.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnToolPanel/modelItemUtils.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/version.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+column-tool-panel@30.1.0/node_modules/@ag-grid-enterprise/column-tool-panel/dist/esm/es6/columnsToolPanelModule.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+menu@30.1.0/node_modules/@ag-grid-enterprise/menu/dist/esm/es6/menu/enterpriseMenu.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+menu@30.1.0/node_modules/@ag-grid-enterprise/menu/dist/esm/es6/menu/contextMenu.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+menu@30.1.0/node_modules/@ag-grid-enterprise/menu/dist/esm/es6/menu/menuItemMapper.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+menu@30.1.0/node_modules/@ag-grid-enterprise/menu/dist/esm/es6/version.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+menu@30.1.0/node_modules/@ag-grid-enterprise/menu/dist/esm/es6/menu/chartMenuItemMapper.mjs","../../../node_modules/.pnpm/@ag-grid-enterprise+menu@30.1.0/node_modules/@ag-grid-enterprise/menu/dist/esm/es6/menuModule.mjs","../../src/components/routes/StockReconciliation/StockReconciliation.tsx","../../src/components/routes/Home/Home.tsx","../../src/store/userSlice.ts","../../src/store/store.ts","../../../node_modules/.pnpm/@sgme+aggrid@1.2.2_@ag-grid-enterprise+core@30.1.0/node_modules/@sgme/aggrid/lib/licence.js","../../../node_modules/.pnpm/@sgme+aggrid@1.2.2_@ag-grid-enterprise+core@30.1.0/node_modules/@sgme/aggrid/lib/index.js","../../src/main.tsx"],"sourcesContent":["export const themeKey = 'Theme';\nexport type Theme = 'DARK' | 'LIGHT';\n\nconst sgbsVersion = import.meta.env.VITE_SGBS_VERSION;\nconst cdnUrl = `https://sgwt-cdn-sgbs.sgmarkets.com/sg-bootstrap/${sgbsVersion}`;\n\nfunction variableSgbsUrls(theme: string | null) {\n const variation = theme === 'DARK' ? 'dark' : 'standard';\n return {\n sgbs: `${cdnUrl}/core/css/sg-bootstrap-${variation}.min.css`,\n icons: `${cdnUrl}/icons/index.min.css`,\n };\n}\n\nexport function initSgBootstrap(theme?: Theme) {\n updateThemeUrls(theme ?? getTheme());\n appendUniqueLinkToDocument('icons', `${cdnUrl}/icons/index.min.css`);\n}\n\nfunction updateThemeUrls(theme: Theme) {\n Object.entries(variableSgbsUrls(theme)).forEach(([id, url]) => {\n appendUniqueLinkToDocument(id, url);\n });\n}\n\nexport function setTheme(theme: Theme) {\n updateThemeUrls(theme);\n // getMatomo().track(\"Workspace\", \"Switch theme\", theme);\n saveToLocalStorage(theme);\n}\n\nexport function getTheme(): Theme {\n const savedTheme = getFromLocalStorage();\n if (savedTheme != null) {\n return savedTheme?.toUpperCase() === 'DARK' ? 'DARK' : 'LIGHT';\n }\n const prefersDark = window.matchMedia?.('(prefers-color-scheme: dark)').matches;\n return prefersDark ? 'DARK' : 'LIGHT';\n}\n\nfunction saveToLocalStorage(theme: Theme) {\n if (typeof localStorage === 'undefined') {\n return;\n }\n try {\n localStorage.setItem(themeKey, theme);\n } catch {\n console.error('Unable to store theme, localStorage might be full');\n }\n}\n\nfunction getFromLocalStorage(): string | null {\n if (typeof localStorage === 'undefined') {\n return null;\n }\n return localStorage.getItem(themeKey);\n}\n\nfunction appendUniqueLinkToDocument(id: string, url: string) {\n const linkElement = document.querySelector(`link[id=\"${id}\"]`);\n const newLinkElement = document.createElement('link');\n newLinkElement.rel = 'stylesheet';\n newLinkElement.id = id;\n newLinkElement.href = url;\n if (linkElement !== null) {\n newLinkElement.onload = () => {\n document.head.removeChild(linkElement);\n };\n }\n document.head.appendChild(newLinkElement);\n}\n","import { initSgBootstrap } from '@/utils/theme';\n\ninitSgBootstrap();\n","/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its 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'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its 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 Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),ca=require(\"scheduler\");function p(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function v(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var z={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){z[a]=new v(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];z[b]=new v(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){z[a]=new v(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){z[a]=new v(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){z[a]=new v(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){z[a]=new v(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){z[a]=new v(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){z[a]=new v(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){z[a]=new v(a,5,!1,a.toLowerCase(),null,!1,!1)});var ra=/[\\-:]([a-z])/g;function sa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(ra,\nsa);z[b]=new v(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!1,!1)});\nz.xlinkHref=new v(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction ta(a,b,c,d){var e=z.hasOwnProperty(b)?z[b]:null;if(null!==e?0!==e.type:d||!(2h||e[g]!==f[h]){var k=\"\\n\"+e[g].replace(\" at new \",\" at \");a.displayName&&k.includes(\"\")&&(k=k.replace(\"\",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{Na=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Ma(a):\"\"}\nfunction Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma(\"Lazy\");case 13:return Ma(\"Suspense\");case 19:return Ma(\"SuspenseList\");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return\"\"}}\nfunction Qa(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ya:return\"Fragment\";case wa:return\"Portal\";case Aa:return\"Profiler\";case za:return\"StrictMode\";case Ea:return\"Suspense\";case Fa:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case Ca:return(a.displayName||\"Context\")+\".Consumer\";case Ba:return(a._context.displayName||\"Context\")+\".Provider\";case Da:var b=a.render;a=a.displayName;a||(a=b.displayName||\nb.name||\"\",a=\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");return a;case Ga:return b=a.displayName||null,null!==b?b:Qa(a.type)||\"Memo\";case Ha:b=a._payload;a=a._init;try{return Qa(a(b))}catch(c){}}return null}\nfunction Ra(a){var b=a.type;switch(a.tag){case 24:return\"Cache\";case 9:return(b.displayName||\"Context\")+\".Consumer\";case 10:return(b._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return a=b.render,a=a.displayName||a.name||\"\",b.displayName||(\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return b;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return Qa(b);case 8:return b===za?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";\ncase 12:return\"Profiler\";case 21:return\"Scope\";case 13:return\"Suspense\";case 19:return\"SuspenseList\";case 25:return\"TracingMarker\";case 1:case 0:case 17:case 2:case 14:case 15:if(\"function\"===typeof b)return b.displayName||b.name||null;if(\"string\"===typeof b)return b}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"string\":case \"undefined\":return a;case \"object\":return a;default:return\"\"}}\nfunction Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return A({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function ab(a,b){b=b.checked;null!=b&&ta(a,\"checked\",b,!1)}\nfunction bb(a,b){ab(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?cb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&cb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction db(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction cb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}var eb=Array.isArray;\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e\"+b.valueOf().toString()+\"\";for(b=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction ob(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,\nzoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(pb).forEach(function(a){qb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pb[b]=pb[a]})});function rb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||pb.hasOwnProperty(a)&&pb[a]?(\"\"+b).trim():b+\"px\"}\nfunction sb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=rb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction ub(a,b){if(b){if(tb[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(p(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(p(60));if(\"object\"!==typeof b.dangerouslySetInnerHTML||!(\"__html\"in b.dangerouslySetInnerHTML))throw Error(p(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(p(62));}}\nfunction vb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return!1;default:return!0}}var wb=null;function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(p(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;a>>=0;return 0===a?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304;\nfunction tc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;\ndefault:return a}}function uc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=tc(h):(f&=g,0!==f&&(d=tc(f)))}else g=c&~e,0!==g?d=tc(g):0!==f&&(d=tc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);return b}\nfunction Ac(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-oc(b);a[b]=c}function Bc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Je(c)}}function Le(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Le(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Me(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Ne(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nfunction Oe(a){var b=Me(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&c&&c.ownerDocument&&Le(c.ownerDocument.documentElement,c)){if(null!==d&&Ne(c))if(b=d.start,a=d.end,void 0===a&&(a=b),\"selectionStart\"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(a=(b=c.ownerDocument||document)&&b.defaultView||window,a.getSelection){a=a.getSelection();var e=c.textContent.length,f=Math.min(d.start,e);d=void 0===d.end?f:Math.min(d.end,e);!a.extend&&f>d&&(e=d,d=f,f=e);e=Ke(c,f);var g=Ke(c,\nd);e&&g&&(1!==a.rangeCount||a.anchorNode!==e.node||a.anchorOffset!==e.offset||a.focusNode!==g.node||a.focusOffset!==g.offset)&&(b=b.createRange(),b.setStart(e.node,e.offset),a.removeAllRanges(),f>d?(a.addRange(b),a.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),a.addRange(b)))}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});\"function\"===typeof c.focus&&c.focus();for(c=0;c=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Ne(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Ie(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(a,b){Tf++;Sf[Tf]=a.current;a.current=b}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,b){var c=a.type.contextTypes;if(!c)return Vf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}\nfunction Zf(a){a=a.childContextTypes;return null!==a&&void 0!==a}function $f(){E(Wf);E(H)}function ag(a,b,c){if(H.current!==Vf)throw Error(p(168));G(H,b);G(Wf,c)}function bg(a,b,c){var d=a.stateNode;b=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(p(108,Ra(a)||\"Unknown\",e));return A({},c,d)}\nfunction cg(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf;Xf=H.current;G(H,a);G(Wf,Wf.current);return!0}function dg(a,b,c){var d=a.stateNode;if(!d)throw Error(p(169));c?(a=bg(a,b,Xf),d.__reactInternalMemoizedMergedChildContext=a,E(Wf),E(H),G(H,a)):E(Wf);G(Wf,c)}var eg=null,fg=!1,gg=!1;function hg(a){null===eg?eg=[a]:eg.push(a)}function ig(a){fg=!0;hg(a)}\nfunction jg(){if(!gg&&null!==eg){gg=!0;var a=0,b=C;try{var c=eg;for(C=1;a>=g;e-=g;rg=1<<32-oc(b)+e|c<w?(x=u,u=null):x=u.sibling;var n=r(e,u,h[w],k);if(null===n){null===u&&(u=x);break}a&&u&&null===n.alternate&&b(e,u);g=f(n,g,w);null===m?l=n:m.sibling=n;m=n;u=x}if(w===h.length)return c(e,u),I&&tg(e,w),l;if(null===u){for(;ww?(x=m,m=null):x=m.sibling;var t=r(e,m,n.value,k);if(null===t){null===m&&(m=x);break}a&&m&&null===t.alternate&&b(e,m);g=f(t,g,w);null===u?l=t:u.sibling=t;u=t;m=x}if(n.done)return c(e,\nm),I&&tg(e,w),l;if(null===m){for(;!n.done;w++,n=h.next())n=q(e,n.value,k),null!==n&&(g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);I&&tg(e,w);return l}for(m=d(e,m);!n.done;w++,n=h.next())n=y(m,e,w,n.value,k),null!==n&&(a&&null!==n.alternate&&m.delete(null===n.key?w:n.key),g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);a&&m.forEach(function(a){return b(e,a)});I&&tg(e,w);return l}function J(a,d,f,h){\"object\"===typeof f&&null!==f&&f.type===ya&&null===f.key&&(f=f.props.children);if(\"object\"===typeof f&&null!==f){switch(f.$$typeof){case va:a:{for(var k=\nf.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ya){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||\"object\"===typeof k&&null!==k&&k.$$typeof===Ha&&uh(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=sh(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling}f.type===ya?(d=Ah(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=yh(f.type,f.key,f.props,null,a.mode,h),h.ref=sh(a,d,f),h.return=a,a=h)}return g(a);case wa:a:{for(l=f.key;null!==\nd;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=zh(f,a.mode,h);d.return=a;a=d}return g(a);case Ha:return l=f._init,J(a,d,l(f._payload),h)}if(eb(f))return n(a,d,f,h);if(Ka(f))return t(a,d,f,h);th(a,f)}return\"string\"===typeof f&&\"\"!==f||\"number\"===typeof f?(f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):\n(c(a,d),d=xh(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return J}var Bh=vh(!0),Ch=vh(!1),Dh={},Eh=Uf(Dh),Fh=Uf(Dh),Gh=Uf(Dh);function Hh(a){if(a===Dh)throw Error(p(174));return a}function Ih(a,b){G(Gh,b);G(Fh,a);G(Eh,Dh);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:lb(null,\"\");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=lb(b,a)}E(Eh);G(Eh,b)}function Jh(){E(Eh);E(Fh);E(Gh)}\nfunction Kh(a){Hh(Gh.current);var b=Hh(Eh.current);var c=lb(b,a.type);b!==c&&(G(Fh,a),G(Eh,c))}function Lh(a){Fh.current===a&&(E(Eh),E(Fh))}var M=Uf(0);\nfunction Mh(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||\"$?\"===c.data||\"$!\"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&128))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}var Nh=[];\nfunction Oh(){for(var a=0;ac?c:4;a(!0);var d=Qh.transition;Qh.transition={};try{a(!1),b()}finally{C=c,Qh.transition=d}}function Fi(){return di().memoizedState}\nfunction Gi(a,b,c){var d=lh(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(Hi(a))Ii(b,c);else if(c=Yg(a,b,c,d),null!==c){var e=L();mh(c,a,d,e);Ji(c,b,d)}}\nfunction ri(a,b,c){var d=lh(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(Hi(a))Ii(b,e);else{var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(He(h,g)){var k=b.interleaved;null===k?(e.next=e,Xg(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(l){}finally{}c=Yg(a,b,e,d);null!==c&&(e=L(),mh(c,a,d,e),Ji(c,b,d))}}\nfunction Hi(a){var b=a.alternate;return a===N||null!==b&&b===N}function Ii(a,b){Th=Sh=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}function Ji(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nvar ai={readContext:Vg,useCallback:Q,useContext:Q,useEffect:Q,useImperativeHandle:Q,useInsertionEffect:Q,useLayoutEffect:Q,useMemo:Q,useReducer:Q,useRef:Q,useState:Q,useDebugValue:Q,useDeferredValue:Q,useTransition:Q,useMutableSource:Q,useSyncExternalStore:Q,useId:Q,unstable_isNewReconciler:!1},Yh={readContext:Vg,useCallback:function(a,b){ci().memoizedState=[a,void 0===b?null:b];return a},useContext:Vg,useEffect:vi,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ti(4194308,\n4,yi.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ti(4194308,4,a,b)},useInsertionEffect:function(a,b){return ti(4,2,a,b)},useMemo:function(a,b){var c=ci();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=ci();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=Gi.bind(null,N,a);return[d.memoizedState,a]},useRef:function(a){var b=\nci();a={current:a};return b.memoizedState=a},useState:qi,useDebugValue:Ai,useDeferredValue:function(a){return ci().memoizedState=a},useTransition:function(){var a=qi(!1),b=a[0];a=Ei.bind(null,a[1]);ci().memoizedState=a;return[b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=N,e=ci();if(I){if(void 0===c)throw Error(p(407));c=c()}else{c=b();if(null===R)throw Error(p(349));0!==(Rh&30)||ni(d,b,c)}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;vi(ki.bind(null,d,\nf,a),[a]);d.flags|=2048;li(9,mi.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=ci(),b=R.identifierPrefix;if(I){var c=sg;var d=rg;c=(d&~(1<<32-oc(d)-1)).toString(32)+c;b=\":\"+b+\"R\"+c;c=Uh++;0\\x3c/script>\",a=a.removeChild(a.firstChild)):\n\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[Of]=b;a[Pf]=d;Aj(a,b,!1,!1);b.stateNode=a;a:{g=vb(c,d);switch(c){case \"dialog\":D(\"cancel\",a);D(\"close\",a);e=d;break;case \"iframe\":case \"object\":case \"embed\":D(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eHj&&(b.flags|=128,d=!0,Ej(f,!1),b.lanes=4194304)}else{if(!d)if(a=Mh(g),null!==a){if(b.flags|=128,d=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Ej(f,!0),null===f.tail&&\"hidden\"===f.tailMode&&!g.alternate&&!I)return S(b),null}else 2*B()-f.renderingStartTime>Hj&&1073741824!==c&&(b.flags|=128,d=!0,Ej(f,!1),b.lanes=4194304);f.isBackwards?(g.sibling=b.child,b.child=g):(c=f.last,null!==c?c.sibling=g:b.child=g,f.last=g)}if(null!==f.tail)return b=f.tail,f.rendering=\nb,f.tail=b.sibling,f.renderingStartTime=B(),b.sibling=null,c=M.current,G(M,d?c&1|2:c&1),b;S(b);return null;case 22:case 23:return Ij(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(gj&1073741824)&&(S(b),b.subtreeFlags&6&&(b.flags|=8192)):S(b),null;case 24:return null;case 25:return null}throw Error(p(156,b.tag));}\nfunction Jj(a,b){wg(b);switch(b.tag){case 1:return Zf(b.type)&&$f(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return Jh(),E(Wf),E(H),Oh(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return Lh(b),null;case 13:E(M);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(p(340));Ig()}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return E(M),null;case 4:return Jh(),null;case 10:return Rg(b.type._context),null;case 22:case 23:return Ij(),\nnull;case 24:return null;default:return null}}var Kj=!1,U=!1,Lj=\"function\"===typeof WeakSet?WeakSet:Set,V=null;function Mj(a,b){var c=a.ref;if(null!==c)if(\"function\"===typeof c)try{c(null)}catch(d){W(a,b,d)}else c.current=null}function Nj(a,b,c){try{c()}catch(d){W(a,b,d)}}var Oj=!1;\nfunction Pj(a,b){Cf=dd;a=Me();if(Ne(a)){if(\"selectionStart\"in a)var c={start:a.selectionStart,end:a.selectionEnd};else a:{c=(c=a.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&0!==d.rangeCount){c=d.anchorNode;var e=d.anchorOffset,f=d.focusNode;d=d.focusOffset;try{c.nodeType,f.nodeType}catch(F){c=null;break a}var g=0,h=-1,k=-1,l=0,m=0,q=a,r=null;b:for(;;){for(var y;;){q!==c||0!==e&&3!==q.nodeType||(h=g+e);q!==f||0!==d&&3!==q.nodeType||(k=g+d);3===q.nodeType&&(g+=\nq.nodeValue.length);if(null===(y=q.firstChild))break;r=q;q=y}for(;;){if(q===a)break b;r===c&&++l===e&&(h=g);r===f&&++m===d&&(k=g);if(null!==(y=q.nextSibling))break;q=r;r=q.parentNode}q=y}c=-1===h||-1===k?null:{start:h,end:k}}else c=null}c=c||{start:0,end:0}}else c=null;Df={focusedElem:a,selectionRange:c};dd=!1;for(V=b;null!==V;)if(b=V,a=b.child,0!==(b.subtreeFlags&1028)&&null!==a)a.return=b,V=a;else for(;null!==V;){b=V;try{var n=b.alternate;if(0!==(b.flags&1024))switch(b.tag){case 0:case 11:case 15:break;\ncase 1:if(null!==n){var t=n.memoizedProps,J=n.memoizedState,x=b.stateNode,w=x.getSnapshotBeforeUpdate(b.elementType===b.type?t:Lg(b.type,t),J);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var u=b.stateNode.containerInfo;1===u.nodeType?u.textContent=\"\":9===u.nodeType&&u.documentElement&&u.removeChild(u.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163));}}catch(F){W(b,b.return,F)}a=b.sibling;if(null!==a){a.return=b.return;V=a;break}V=b.return}n=Oj;Oj=!1;return n}\nfunction Qj(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Nj(b,c,f)}e=e.next}while(e!==d)}}function Rj(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d()}c=c.next}while(c!==b)}}function Sj(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c}\"function\"===typeof b?b(a):b.current=a}}\nfunction Tj(a){var b=a.alternate;null!==b&&(a.alternate=null,Tj(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&(delete b[Of],delete b[Pf],delete b[of],delete b[Qf],delete b[Rf]));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null}function Uj(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction Vj(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Uj(a.return))return null;a=a.return}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}\nfunction Wj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=Bf));else if(4!==d&&(a=a.child,null!==a))for(Wj(a,b,c),a=a.sibling;null!==a;)Wj(a,b,c),a=a.sibling}\nfunction Xj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(Xj(a,b,c),a=a.sibling;null!==a;)Xj(a,b,c),a=a.sibling}var X=null,Yj=!1;function Zj(a,b,c){for(c=c.child;null!==c;)ak(a,b,c),c=c.sibling}\nfunction ak(a,b,c){if(lc&&\"function\"===typeof lc.onCommitFiberUnmount)try{lc.onCommitFiberUnmount(kc,c)}catch(h){}switch(c.tag){case 5:U||Mj(c,b);case 6:var d=X,e=Yj;X=null;Zj(a,b,c);X=d;Yj=e;null!==X&&(Yj?(a=X,c=c.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):X.removeChild(c.stateNode));break;case 18:null!==X&&(Yj?(a=X,c=c.stateNode,8===a.nodeType?Kf(a.parentNode,c):1===a.nodeType&&Kf(a,c),bd(a)):Kf(X,c.stateNode));break;case 4:d=X;e=Yj;X=c.stateNode.containerInfo;Yj=!0;\nZj(a,b,c);X=d;Yj=e;break;case 0:case 11:case 14:case 15:if(!U&&(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?Nj(c,b,g):0!==(f&4)&&Nj(c,b,g));e=e.next}while(e!==d)}Zj(a,b,c);break;case 1:if(!U&&(Mj(c,b),d=c.stateNode,\"function\"===typeof d.componentWillUnmount))try{d.props=c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount()}catch(h){W(c,b,h)}Zj(a,b,c);break;case 21:Zj(a,b,c);break;case 22:c.mode&1?(U=(d=U)||null!==\nc.memoizedState,Zj(a,b,c),U=d):Zj(a,b,c);break;default:Zj(a,b,c)}}function bk(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Lj);b.forEach(function(b){var d=ck.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}\nfunction dk(a,b){var c=b.deletions;if(null!==c)for(var d=0;de&&(e=g);d&=~f}d=e;d=B()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*mk(d/1960))-d;if(10a?16:a;if(null===xk)var d=!1;else{a=xk;xk=null;yk=0;if(0!==(K&6))throw Error(p(331));var e=K;K|=4;for(V=a.current;null!==V;){var f=V,g=f.child;if(0!==(V.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kB()-gk?Lk(a,0):sk|=c);Ek(a,b)}function Zk(a,b){0===b&&(0===(a.mode&1)?b=1:(b=sc,sc<<=1,0===(sc&130023424)&&(sc=4194304)));var c=L();a=Zg(a,b);null!==a&&(Ac(a,b,c),Ek(a,c))}function vj(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Zk(a,c)}\nfunction ck(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(p(314));}null!==d&&d.delete(b);Zk(a,c)}var Wk;\nWk=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||Wf.current)Ug=!0;else{if(0===(a.lanes&c)&&0===(b.flags&128))return Ug=!1,zj(a,b,c);Ug=0!==(a.flags&131072)?!0:!1}else Ug=!1,I&&0!==(b.flags&1048576)&&ug(b,ng,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;jj(a,b);a=b.pendingProps;var e=Yf(b,H.current);Tg(b,c);e=Xh(null,b,d,a,e,c);var f=bi();b.flags|=1;\"object\"===typeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof?(b.tag=1,b.memoizedState=null,b.updateQueue=\nnull,Zf(d)?(f=!0,cg(b)):f=!1,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,ah(b),e.updater=nh,b.stateNode=e,e._reactInternals=b,rh(b,d,a,c),b=kj(null,b,d,!0,f,c)):(b.tag=0,I&&f&&vg(b),Yi(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{jj(a,b);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=$k(d);a=Lg(d,a);switch(e){case 0:b=dj(null,b,d,a,c);break a;case 1:b=ij(null,b,d,a,c);break a;case 11:b=Zi(null,b,d,a,c);break a;case 14:b=aj(null,b,d,Lg(d.type,a),c);break a}throw Error(p(306,\nd,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),dj(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),ij(a,b,d,e,c);case 3:a:{lj(b);if(null===a)throw Error(p(387));d=b.pendingProps;f=b.memoizedState;e=f.element;bh(a,b);gh(b,d,null,c);var g=b.memoizedState;d=g.element;if(f.isDehydrated)if(f={element:d,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},b.updateQueue.baseState=\nf,b.memoizedState=f,b.flags&256){e=Ki(Error(p(423)),b);b=mj(a,b,d,c,e);break a}else if(d!==e){e=Ki(Error(p(424)),b);b=mj(a,b,d,c,e);break a}else for(yg=Lf(b.stateNode.containerInfo.firstChild),xg=b,I=!0,zg=null,c=Ch(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{Ig();if(d===e){b=$i(a,b,c);break a}Yi(a,b,d,c)}b=b.child}return b;case 5:return Kh(b),null===a&&Eg(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Ef(d,e)?g=null:null!==f&&Ef(d,f)&&(b.flags|=32),\nhj(a,b),Yi(a,b,g,c),b.child;case 6:return null===a&&Eg(b),null;case 13:return pj(a,b,c);case 4:return Ih(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Bh(b,null,d,c):Yi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),Zi(a,b,d,e,c);case 7:return Yi(a,b,b.pendingProps,c),b.child;case 8:return Yi(a,b,b.pendingProps.children,c),b.child;case 12:return Yi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;f=b.memoizedProps;\ng=e.value;G(Mg,d._currentValue);d._currentValue=g;if(null!==f)if(He(f.value,g)){if(f.children===e.children&&!Wf.current){b=$i(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=ch(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=c);Sg(f.return,\nc,b);h.lanes|=c;break}k=k.next}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(p(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);Sg(g,c,b);g=f.sibling}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return}f=g}Yi(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,d=b.pendingProps.children,Tg(b,c),e=Vg(e),d=d(e),b.flags|=1,Yi(a,b,d,c),\nb.child;case 14:return d=b.type,e=Lg(d,b.pendingProps),e=Lg(d.type,e),aj(a,b,d,e,c);case 15:return cj(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),jj(a,b),b.tag=1,Zf(d)?(a=!0,cg(b)):a=!1,Tg(b,c),ph(b,d,e),rh(b,d,e,c),kj(null,b,d,!0,a,c);case 19:return yj(a,b,c);case 22:return ej(a,b,c)}throw Error(p(156,b.tag));};function Gk(a,b){return ac(a,b)}\nfunction al(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null}function Bg(a,b,c,d){return new al(a,b,c,d)}function bj(a){a=a.prototype;return!(!a||!a.isReactComponent)}\nfunction $k(a){if(\"function\"===typeof a)return bj(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Da)return 11;if(a===Ga)return 14}return 2}\nfunction wh(a,b){var c=a.alternate;null===c?(c=Bg(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};\nc.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}\nfunction yh(a,b,c,d,e,f){var g=2;d=a;if(\"function\"===typeof a)bj(a)&&(g=1);else if(\"string\"===typeof a)g=5;else a:switch(a){case ya:return Ah(c.children,e,f,b);case za:g=8;e|=8;break;case Aa:return a=Bg(12,c,b,e|2),a.elementType=Aa,a.lanes=f,a;case Ea:return a=Bg(13,c,b,e),a.elementType=Ea,a.lanes=f,a;case Fa:return a=Bg(19,c,b,e),a.elementType=Fa,a.lanes=f,a;case Ia:return qj(c,e,f,b);default:if(\"object\"===typeof a&&null!==a)switch(a.$$typeof){case Ba:g=10;break a;case Ca:g=9;break a;case Da:g=11;\nbreak a;case Ga:g=14;break a;case Ha:g=16;d=null;break a}throw Error(p(130,null==a?a:typeof a,\"\"));}b=Bg(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Ah(a,b,c,d){a=Bg(7,a,d,b);a.lanes=c;return a}function qj(a,b,c,d){a=Bg(22,a,d,b);a.elementType=Ia;a.lanes=c;a.stateNode={isHidden:!1};return a}function xh(a,b,c){a=Bg(6,a,null,b);a.lanes=c;return a}\nfunction zh(a,b,c){b=Bg(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}\nfunction bl(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=zc(0);this.expirationTimes=zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=zc(0);this.identifierPrefix=d;this.onRecoverableError=e;this.mutableSourceEagerHydrationData=\nnull}function cl(a,b,c,d,e,f,g,h,k){a=new bl(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=Bg(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null};ah(f);return a}function dl(a,b,c){var d=3 batch = newBatch; // Supply a getter just to skip dealing with ESM bindings\n\nexport const getBatch = () => batch;","import * as React from 'react';\nconst ContextKey = Symbol.for(`react-redux-context`);\nconst gT = typeof globalThis !== \"undefined\" ? globalThis :\n/* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */\n{};\n\nfunction getContext() {\n var _gT$ContextKey;\n\n if (!React.createContext) return {};\n const contextMap = (_gT$ContextKey = gT[ContextKey]) != null ? _gT$ContextKey : gT[ContextKey] = new Map();\n let realContext = contextMap.get(React.createContext);\n\n if (!realContext) {\n realContext = React.createContext(null);\n\n if (process.env.NODE_ENV !== 'production') {\n realContext.displayName = 'ReactRedux';\n }\n\n contextMap.set(React.createContext, realContext);\n }\n\n return realContext;\n}\n\nexport const ReactReduxContext = /*#__PURE__*/getContext();\nexport default ReactReduxContext;","import { useContext } from 'react';\nimport { ReactReduxContext } from '../components/Context';\n\n/**\n * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level\n * hook that you should usually not need to call directly.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\n * @returns {Function} A `useReduxContext` hook bound to the specified context.\n */\nexport function createReduxContextHook(context = ReactReduxContext) {\n return function useReduxContext() {\n const contextValue = useContext(context);\n\n if (process.env.NODE_ENV !== 'production' && !contextValue) {\n throw new Error('could not find react-redux context value; please ensure the component is wrapped in a ');\n }\n\n return contextValue;\n };\n}\n/**\n * A hook to access the value of the `ReactReduxContext`. This is a low-level\n * hook that you should usually not need to call directly.\n *\n * @returns {any} the value of the `ReactReduxContext`\n *\n * @example\n *\n * import React from 'react'\n * import { useReduxContext } from 'react-redux'\n *\n * export const CounterComponent = () => {\n * const { store } = useReduxContext()\n * return
{store.getState()}
\n * }\n */\n\nexport const useReduxContext = /*#__PURE__*/createReduxContextHook();","export const notInitialized = () => {\n throw new Error('uSES not initialized!');\n};","import { useCallback, useDebugValue, useRef } from 'react';\nimport { createReduxContextHook, useReduxContext as useDefaultReduxContext } from './useReduxContext';\nimport { ReactReduxContext } from '../components/Context';\nimport { notInitialized } from '../utils/useSyncExternalStore';\nlet useSyncExternalStoreWithSelector = notInitialized;\nexport const initializeUseSelector = fn => {\n useSyncExternalStoreWithSelector = fn;\n};\n\nconst refEquality = (a, b) => a === b;\n/**\n * Hook factory, which creates a `useSelector` hook bound to a given context.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\n * @returns {Function} A `useSelector` hook bound to the specified context.\n */\n\n\nexport function createSelectorHook(context = ReactReduxContext) {\n const useReduxContext = context === ReactReduxContext ? useDefaultReduxContext : createReduxContextHook(context);\n return function useSelector(selector, equalityFnOrOptions = {}) {\n const {\n equalityFn = refEquality,\n stabilityCheck = undefined,\n noopCheck = undefined\n } = typeof equalityFnOrOptions === 'function' ? {\n equalityFn: equalityFnOrOptions\n } : equalityFnOrOptions;\n\n if (process.env.NODE_ENV !== 'production') {\n if (!selector) {\n throw new Error(`You must pass a selector to useSelector`);\n }\n\n if (typeof selector !== 'function') {\n throw new Error(`You must pass a function as a selector to useSelector`);\n }\n\n if (typeof equalityFn !== 'function') {\n throw new Error(`You must pass a function as an equality function to useSelector`);\n }\n }\n\n const {\n store,\n subscription,\n getServerState,\n stabilityCheck: globalStabilityCheck,\n noopCheck: globalNoopCheck\n } = useReduxContext();\n const firstRun = useRef(true);\n const wrappedSelector = useCallback({\n [selector.name](state) {\n const selected = selector(state);\n\n if (process.env.NODE_ENV !== 'production') {\n const finalStabilityCheck = typeof stabilityCheck === 'undefined' ? globalStabilityCheck : stabilityCheck;\n\n if (finalStabilityCheck === 'always' || finalStabilityCheck === 'once' && firstRun.current) {\n const toCompare = selector(state);\n\n if (!equalityFn(selected, toCompare)) {\n console.warn('Selector ' + (selector.name || 'unknown') + ' returned a different result when called with the same parameters. This can lead to unnecessary rerenders.' + '\\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization', {\n state,\n selected,\n selected2: toCompare\n });\n }\n }\n\n const finalNoopCheck = typeof noopCheck === 'undefined' ? globalNoopCheck : noopCheck;\n\n if (finalNoopCheck === 'always' || finalNoopCheck === 'once' && firstRun.current) {\n // @ts-ignore\n if (selected === state) {\n console.warn('Selector ' + (selector.name || 'unknown') + ' returned the root state when called. This can lead to unnecessary rerenders.' + '\\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.');\n }\n }\n\n if (firstRun.current) firstRun.current = false;\n }\n\n return selected;\n }\n\n }[selector.name], [selector, globalStabilityCheck, stabilityCheck]);\n const selectedState = useSyncExternalStoreWithSelector(subscription.addNestedSub, store.getState, getServerState || store.getState, wrappedSelector, equalityFn);\n useDebugValue(selectedState);\n return selectedState;\n };\n}\n/**\n * A hook to access the redux store's state. This hook takes a selector function\n * as an argument. The selector is called with the store state.\n *\n * This hook takes an optional equality comparison function as the second parameter\n * that allows you to customize the way the selected state is compared to determine\n * whether the component needs to be re-rendered.\n *\n * @param {Function} selector the selector function\n * @param {Function=} equalityFn the function that will be used to determine equality\n *\n * @returns {any} the selected state\n *\n * @example\n *\n * import React from 'react'\n * import { useSelector } from 'react-redux'\n *\n * export const CounterComponent = () => {\n * const counter = useSelector(state => state.counter)\n * return
{counter}
\n * }\n */\n\nexport const useSelector = /*#__PURE__*/createSelectorHook();","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its 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';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n};\nvar KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n};\nvar FORWARD_REF_STATICS = {\n '$$typeof': true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true\n};\nvar MEMO_STATICS = {\n '$$typeof': true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\n\nfunction getStatics(component) {\n // React v16.11 and below\n if (reactIs.isMemo(component)) {\n return MEMO_STATICS;\n } // React v16.12 and above\n\n\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\n\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n\n var keys = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n var targetStatics = getStatics(targetComponent);\n var sourceStatics = getStatics(sourceComponent);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n }\n\n return targetComponent;\n}\n\nmodule.exports = hoistNonReactStatics;\n","/**\n * @license React\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its 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'use strict';var b=Symbol.for(\"react.element\"),c=Symbol.for(\"react.portal\"),d=Symbol.for(\"react.fragment\"),e=Symbol.for(\"react.strict_mode\"),f=Symbol.for(\"react.profiler\"),g=Symbol.for(\"react.provider\"),h=Symbol.for(\"react.context\"),k=Symbol.for(\"react.server_context\"),l=Symbol.for(\"react.forward_ref\"),m=Symbol.for(\"react.suspense\"),n=Symbol.for(\"react.suspense_list\"),p=Symbol.for(\"react.memo\"),q=Symbol.for(\"react.lazy\"),t=Symbol.for(\"react.offscreen\"),u;u=Symbol.for(\"react.module.reference\");\nfunction v(a){if(\"object\"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m;\nexports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p};\nexports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||\"object\"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","import { getBatch } from './batch'; // encapsulates the subscription logic for connecting a component to the redux store, as\n// well as nesting subscriptions of descendant components, so that we can ensure the\n// ancestor components re-render before descendants\n\nfunction createListenerCollection() {\n const batch = getBatch();\n let first = null;\n let last = null;\n return {\n clear() {\n first = null;\n last = null;\n },\n\n notify() {\n batch(() => {\n let listener = first;\n\n while (listener) {\n listener.callback();\n listener = listener.next;\n }\n });\n },\n\n get() {\n let listeners = [];\n let listener = first;\n\n while (listener) {\n listeners.push(listener);\n listener = listener.next;\n }\n\n return listeners;\n },\n\n subscribe(callback) {\n let isSubscribed = true;\n let listener = last = {\n callback,\n next: null,\n prev: last\n };\n\n if (listener.prev) {\n listener.prev.next = listener;\n } else {\n first = listener;\n }\n\n return function unsubscribe() {\n if (!isSubscribed || first === null) return;\n isSubscribed = false;\n\n if (listener.next) {\n listener.next.prev = listener.prev;\n } else {\n last = listener.prev;\n }\n\n if (listener.prev) {\n listener.prev.next = listener.next;\n } else {\n first = listener.next;\n }\n };\n }\n\n };\n}\n\nconst nullListeners = {\n notify() {},\n\n get: () => []\n};\nexport function createSubscription(store, parentSub) {\n let unsubscribe;\n let listeners = nullListeners;\n\n function addNestedSub(listener) {\n trySubscribe();\n return listeners.subscribe(listener);\n }\n\n function notifyNestedSubs() {\n listeners.notify();\n }\n\n function handleChangeWrapper() {\n if (subscription.onStateChange) {\n subscription.onStateChange();\n }\n }\n\n function isSubscribed() {\n return Boolean(unsubscribe);\n }\n\n function trySubscribe() {\n if (!unsubscribe) {\n unsubscribe = parentSub ? parentSub.addNestedSub(handleChangeWrapper) : store.subscribe(handleChangeWrapper);\n listeners = createListenerCollection();\n }\n }\n\n function tryUnsubscribe() {\n if (unsubscribe) {\n unsubscribe();\n unsubscribe = undefined;\n listeners.clear();\n listeners = nullListeners;\n }\n }\n\n const subscription = {\n addNestedSub,\n notifyNestedSubs,\n handleChangeWrapper,\n isSubscribed,\n trySubscribe,\n tryUnsubscribe,\n getListeners: () => listeners\n };\n return subscription;\n}","import * as React from 'react'; // React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser. We need useLayoutEffect to ensure the store\n// subscription callback always has the selector from the latest render commit\n// available, otherwise a store update may happen between render and the effect,\n// which may cause missed updates; we also must ensure the store subscription\n// is created synchronously, otherwise a store update may occur before the\n// subscription is created and an inconsistent state may be observed\n// Matches logic in React's `shared/ExecutionEnvironment` file\n\nexport const canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\nexport const useIsomorphicLayoutEffect = canUseDOM ? React.useLayoutEffect : React.useEffect;","function is(x, y) {\n if (x === y) {\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n}\n\nexport default function shallowEqual(objA, objB) {\n if (is(objA, objB)) return true;\n\n if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {\n return false;\n }\n\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n if (keysA.length !== keysB.length) return false;\n\n for (let i = 0; i < keysA.length; i++) {\n if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {\n return false;\n }\n }\n\n return true;\n}","import * as React from 'react';\nimport { ReactReduxContext } from './Context';\nimport { createSubscription } from '../utils/Subscription';\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect';\n\nfunction Provider({\n store,\n context,\n children,\n serverState,\n stabilityCheck = 'once',\n noopCheck = 'once'\n}) {\n const contextValue = React.useMemo(() => {\n const subscription = createSubscription(store);\n return {\n store,\n subscription,\n getServerState: serverState ? () => serverState : undefined,\n stabilityCheck,\n noopCheck\n };\n }, [store, serverState, stabilityCheck, noopCheck]);\n const previousState = React.useMemo(() => store.getState(), [store]);\n useIsomorphicLayoutEffect(() => {\n const {\n subscription\n } = contextValue;\n subscription.onStateChange = subscription.notifyNestedSubs;\n subscription.trySubscribe();\n\n if (previousState !== store.getState()) {\n subscription.notifyNestedSubs();\n }\n\n return () => {\n subscription.tryUnsubscribe();\n subscription.onStateChange = undefined;\n };\n }, [contextValue, previousState]);\n const Context = context || ReactReduxContext; // @ts-ignore 'AnyAction' is assignable to the constraint of type 'A', but 'A' could be instantiated with a different subtype\n\n return /*#__PURE__*/React.createElement(Context.Provider, {\n value: contextValue\n }, children);\n}\n\nexport default Provider;","import { ReactReduxContext } from '../components/Context';\nimport { useReduxContext as useDefaultReduxContext, createReduxContextHook } from './useReduxContext';\n/**\n * Hook factory, which creates a `useStore` hook bound to a given context.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\n * @returns {Function} A `useStore` hook bound to the specified context.\n */\n\nexport function createStoreHook(context = ReactReduxContext) {\n const useReduxContext = // @ts-ignore\n context === ReactReduxContext ? useDefaultReduxContext : // @ts-ignore\n createReduxContextHook(context);\n return function useStore() {\n const {\n store\n } = useReduxContext(); // @ts-ignore\n\n return store;\n };\n}\n/**\n * A hook to access the redux store.\n *\n * @returns {any} the redux store\n *\n * @example\n *\n * import React from 'react'\n * import { useStore } from 'react-redux'\n *\n * export const ExampleComponent = () => {\n * const store = useStore()\n * return
{store.getState()}
\n * }\n */\n\nexport const useStore = /*#__PURE__*/createStoreHook();","import { ReactReduxContext } from '../components/Context';\nimport { useStore as useDefaultStore, createStoreHook } from './useStore';\n/**\n * Hook factory, which creates a `useDispatch` hook bound to a given context.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\n * @returns {Function} A `useDispatch` hook bound to the specified context.\n */\n\nexport function createDispatchHook(context = ReactReduxContext) {\n const useStore = // @ts-ignore\n context === ReactReduxContext ? useDefaultStore : createStoreHook(context);\n return function useDispatch() {\n const store = useStore(); // @ts-ignore\n\n return store.dispatch;\n };\n}\n/**\n * A hook to access the redux `dispatch` function.\n *\n * @returns {any|function} redux store's `dispatch` function\n *\n * @example\n *\n * import React, { useCallback } from 'react'\n * import { useDispatch } from 'react-redux'\n *\n * export const CounterComponent = ({ value }) => {\n * const dispatch = useDispatch()\n * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])\n * return (\n *
\n * {value}\n * \n *
\n * )\n * }\n */\n\nexport const useDispatch = /*#__PURE__*/createDispatchHook();","// The primary entry point assumes we're working with standard ReactDOM/RN, but\n// older versions that do not include `useSyncExternalStore` (React 16.9 - 17.x).\n// Because of that, the useSyncExternalStore compat shim is needed.\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates';\nimport { setBatch } from './utils/batch';\nimport { initializeUseSelector } from './hooks/useSelector';\nimport { initializeConnect } from './components/connect';\ninitializeUseSelector(useSyncExternalStoreWithSelector);\ninitializeConnect(useSyncExternalStore); // Enable batched updates in our subscriptions for use\n// with standard React renderers (ReactDOM, React Native)\n\nsetBatch(batch);\nexport { batch };\nexport * from './exports';","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/**\n * Cannot do Math.log(x) / Math.log(10) bc if IEEE floating point issue\n * @param x number\n */\nexport function getMagnitude(x) {\n // Cannot count string length via Number.toString because it may use scientific notation\n // for very small or very large numbers.\n return Math.floor(Math.log(x) * Math.LOG10E);\n}\nexport function repeat(s, times) {\n if (typeof s.repeat === 'function') {\n return s.repeat(times);\n }\n var arr = new Array(times);\n for (var i = 0; i < arr.length; i++) {\n arr[i] = s;\n }\n return arr.join('');\n}\nexport function setInternalSlot(map, pl, field, value) {\n if (!map.get(pl)) {\n map.set(pl, Object.create(null));\n }\n var slots = map.get(pl);\n slots[field] = value;\n}\nexport function setMultiInternalSlots(map, pl, props) {\n for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {\n var k = _a[_i];\n setInternalSlot(map, pl, k, props[k]);\n }\n}\nexport function getInternalSlot(map, pl, field) {\n return getMultiInternalSlots(map, pl, field)[field];\n}\nexport function getMultiInternalSlots(map, pl) {\n var fields = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n fields[_i - 2] = arguments[_i];\n }\n var slots = map.get(pl);\n if (!slots) {\n throw new TypeError(\"\".concat(pl, \" InternalSlot has not been initialized\"));\n }\n return fields.reduce(function (all, f) {\n all[f] = slots[f];\n return all;\n }, Object.create(null));\n}\nexport function isLiteralPart(patternPart) {\n return patternPart.type === 'literal';\n}\n/*\n 17 ECMAScript Standard Built-in Objects:\n Every built-in Function object, including constructors, that is not\n identified as an anonymous function has a name property whose value\n is a String.\n\n Unless otherwise specified, the name property of a built-in Function\n object, if it exists, has the attributes { [[Writable]]: false,\n [[Enumerable]]: false, [[Configurable]]: true }.\n*/\nexport function defineProperty(target, name, _a) {\n var value = _a.value;\n Object.defineProperty(target, name, {\n configurable: true,\n enumerable: false,\n writable: true,\n value: value,\n });\n}\nexport var UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;\nexport function invariant(condition, message, Err) {\n if (Err === void 0) { Err = Error; }\n if (!condition) {\n throw new Err(message);\n }\n}\n","export var ErrorKind;\n(function (ErrorKind) {\n /** Argument is unclosed (e.g. `{0`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_CLOSING_BRACE\"] = 1] = \"EXPECT_ARGUMENT_CLOSING_BRACE\";\n /** Argument is empty (e.g. `{}`). */\n ErrorKind[ErrorKind[\"EMPTY_ARGUMENT\"] = 2] = \"EMPTY_ARGUMENT\";\n /** Argument is malformed (e.g. `{foo!}``) */\n ErrorKind[ErrorKind[\"MALFORMED_ARGUMENT\"] = 3] = \"MALFORMED_ARGUMENT\";\n /** Expect an argument type (e.g. `{foo,}`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_TYPE\"] = 4] = \"EXPECT_ARGUMENT_TYPE\";\n /** Unsupported argument type (e.g. `{foo,foo}`) */\n ErrorKind[ErrorKind[\"INVALID_ARGUMENT_TYPE\"] = 5] = \"INVALID_ARGUMENT_TYPE\";\n /** Expect an argument style (e.g. `{foo, number, }`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_STYLE\"] = 6] = \"EXPECT_ARGUMENT_STYLE\";\n /** The number skeleton is invalid. */\n ErrorKind[ErrorKind[\"INVALID_NUMBER_SKELETON\"] = 7] = \"INVALID_NUMBER_SKELETON\";\n /** The date time skeleton is invalid. */\n ErrorKind[ErrorKind[\"INVALID_DATE_TIME_SKELETON\"] = 8] = \"INVALID_DATE_TIME_SKELETON\";\n /** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */\n ErrorKind[ErrorKind[\"EXPECT_NUMBER_SKELETON\"] = 9] = \"EXPECT_NUMBER_SKELETON\";\n /** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */\n ErrorKind[ErrorKind[\"EXPECT_DATE_TIME_SKELETON\"] = 10] = \"EXPECT_DATE_TIME_SKELETON\";\n /** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */\n ErrorKind[ErrorKind[\"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\"] = 11] = \"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\";\n /** Missing select argument options (e.g. `{foo, select}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_OPTIONS\"] = 12] = \"EXPECT_SELECT_ARGUMENT_OPTIONS\";\n /** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 13] = \"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\";\n /** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */\n ErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 14] = \"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\";\n /** Expecting a selector in `select` argument (e.g `{foo, select}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR\"] = 15] = \"EXPECT_SELECT_ARGUMENT_SELECTOR\";\n /** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR\"] = 16] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR\";\n /** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\"] = 17] = \"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\";\n /**\n * Expecting a message fragment after the `plural` or `selectordinal` selector\n * (e.g. `{foo, plural, one}`)\n */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\"] = 18] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\";\n /** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */\n ErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_SELECTOR\"] = 19] = \"INVALID_PLURAL_ARGUMENT_SELECTOR\";\n /**\n * Duplicate selectors in `plural` or `selectordinal` argument.\n * (e.g. {foo, plural, one {#} one {#}})\n */\n ErrorKind[ErrorKind[\"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\"] = 20] = \"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\";\n /** Duplicate selectors in `select` argument.\n * (e.g. {foo, select, apple {apple} apple {apple}})\n */\n ErrorKind[ErrorKind[\"DUPLICATE_SELECT_ARGUMENT_SELECTOR\"] = 21] = \"DUPLICATE_SELECT_ARGUMENT_SELECTOR\";\n /** Plural or select argument option must have `other` clause. */\n ErrorKind[ErrorKind[\"MISSING_OTHER_CLAUSE\"] = 22] = \"MISSING_OTHER_CLAUSE\";\n /** The tag is malformed. (e.g. `foo) */\n ErrorKind[ErrorKind[\"INVALID_TAG\"] = 23] = \"INVALID_TAG\";\n /** The tag name is invalid. (e.g. `<123>foo`) */\n ErrorKind[ErrorKind[\"INVALID_TAG_NAME\"] = 25] = \"INVALID_TAG_NAME\";\n /** The closing tag does not match the opening tag. (e.g. `foo`) */\n ErrorKind[ErrorKind[\"UNMATCHED_CLOSING_TAG\"] = 26] = \"UNMATCHED_CLOSING_TAG\";\n /** The opening tag has unmatched closing tag. (e.g. `foo`) */\n ErrorKind[ErrorKind[\"UNCLOSED_TAG\"] = 27] = \"UNCLOSED_TAG\";\n})(ErrorKind || (ErrorKind = {}));\n","export var TYPE;\n(function (TYPE) {\n /**\n * Raw text\n */\n TYPE[TYPE[\"literal\"] = 0] = \"literal\";\n /**\n * Variable w/o any format, e.g `var` in `this is a {var}`\n */\n TYPE[TYPE[\"argument\"] = 1] = \"argument\";\n /**\n * Variable w/ number format\n */\n TYPE[TYPE[\"number\"] = 2] = \"number\";\n /**\n * Variable w/ date format\n */\n TYPE[TYPE[\"date\"] = 3] = \"date\";\n /**\n * Variable w/ time format\n */\n TYPE[TYPE[\"time\"] = 4] = \"time\";\n /**\n * Variable w/ select format\n */\n TYPE[TYPE[\"select\"] = 5] = \"select\";\n /**\n * Variable w/ plural format\n */\n TYPE[TYPE[\"plural\"] = 6] = \"plural\";\n /**\n * Only possible within plural argument.\n * This is the `#` symbol that will be substituted with the count.\n */\n TYPE[TYPE[\"pound\"] = 7] = \"pound\";\n /**\n * XML-like tag\n */\n TYPE[TYPE[\"tag\"] = 8] = \"tag\";\n})(TYPE || (TYPE = {}));\nexport var SKELETON_TYPE;\n(function (SKELETON_TYPE) {\n SKELETON_TYPE[SKELETON_TYPE[\"number\"] = 0] = \"number\";\n SKELETON_TYPE[SKELETON_TYPE[\"dateTime\"] = 1] = \"dateTime\";\n})(SKELETON_TYPE || (SKELETON_TYPE = {}));\n/**\n * Type Guards\n */\nexport function isLiteralElement(el) {\n return el.type === TYPE.literal;\n}\nexport function isArgumentElement(el) {\n return el.type === TYPE.argument;\n}\nexport function isNumberElement(el) {\n return el.type === TYPE.number;\n}\nexport function isDateElement(el) {\n return el.type === TYPE.date;\n}\nexport function isTimeElement(el) {\n return el.type === TYPE.time;\n}\nexport function isSelectElement(el) {\n return el.type === TYPE.select;\n}\nexport function isPluralElement(el) {\n return el.type === TYPE.plural;\n}\nexport function isPoundElement(el) {\n return el.type === TYPE.pound;\n}\nexport function isTagElement(el) {\n return el.type === TYPE.tag;\n}\nexport function isNumberSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number);\n}\nexport function isDateTimeSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime);\n}\nexport function createLiteralElement(value) {\n return {\n type: TYPE.literal,\n value: value,\n };\n}\nexport function createNumberElement(value, style) {\n return {\n type: TYPE.number,\n value: value,\n style: style,\n };\n}\n","// @generated from regex-gen.ts\nexport var SPACE_SEPARATOR_REGEX = /[ \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/;\nexport var WHITE_SPACE_REGEX = /[\\t-\\r \\x85\\u200E\\u200F\\u2028\\u2029]/;\n","/**\n * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js\n * with some tweaks\n */\nvar DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n/**\n * Parse Date time skeleton into Intl.DateTimeFormatOptions\n * Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * @public\n * @param skeleton skeleton string\n */\nexport function parseDateTimeSkeleton(skeleton) {\n var result = {};\n skeleton.replace(DATE_TIME_REGEX, function (match) {\n var len = match.length;\n switch (match[0]) {\n // Era\n case 'G':\n result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';\n break;\n // Year\n case 'y':\n result.year = len === 2 ? '2-digit' : 'numeric';\n break;\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n throw new RangeError('`Y/u/U/r` (year) patterns are not supported, use `y` instead');\n // Quarter\n case 'q':\n case 'Q':\n throw new RangeError('`q/Q` (quarter) patterns are not supported');\n // Month\n case 'M':\n case 'L':\n result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1];\n break;\n // Week\n case 'w':\n case 'W':\n throw new RangeError('`w/W` (week) patterns are not supported');\n case 'd':\n result.day = ['numeric', '2-digit'][len - 1];\n break;\n case 'D':\n case 'F':\n case 'g':\n throw new RangeError('`D/F/g` (day) patterns are not supported, use `d` instead');\n // Weekday\n case 'E':\n result.weekday = len === 4 ? 'short' : len === 5 ? 'narrow' : 'short';\n break;\n case 'e':\n if (len < 4) {\n throw new RangeError('`e..eee` (weekday) patterns are not supported');\n }\n result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];\n break;\n case 'c':\n if (len < 4) {\n throw new RangeError('`c..ccc` (weekday) patterns are not supported');\n }\n result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];\n break;\n // Period\n case 'a': // AM, PM\n result.hour12 = true;\n break;\n case 'b': // am, pm, noon, midnight\n case 'B': // flexible day periods\n throw new RangeError('`b/B` (period) patterns are not supported, use `a` instead');\n // Hour\n case 'h':\n result.hourCycle = 'h12';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'H':\n result.hourCycle = 'h23';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'K':\n result.hourCycle = 'h11';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'k':\n result.hourCycle = 'h24';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'j':\n case 'J':\n case 'C':\n throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead');\n // Minute\n case 'm':\n result.minute = ['numeric', '2-digit'][len - 1];\n break;\n // Second\n case 's':\n result.second = ['numeric', '2-digit'][len - 1];\n break;\n case 'S':\n case 'A':\n throw new RangeError('`S/A` (second) patterns are not supported, use `s` instead');\n // Zone\n case 'z': // 1..3, 4: specific non-location format\n result.timeZoneName = len < 4 ? 'short' : 'long';\n break;\n case 'Z': // 1..3, 4, 5: The ISO8601 varios formats\n case 'O': // 1, 4: miliseconds in day short, long\n case 'v': // 1, 4: generic non-location format\n case 'V': // 1, 2, 3, 4: time zone ID or city\n case 'X': // 1, 2, 3, 4: The ISO8601 varios formats\n case 'x': // 1, 2, 3, 4: The ISO8601 varios formats\n throw new RangeError('`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead');\n }\n return '';\n });\n return result;\n}\n","// @generated from regex-gen.ts\nexport var WHITE_SPACE_REGEX = /[\\t-\\r \\x85\\u200E\\u200F\\u2028\\u2029]/i;\n","import { __assign } from \"tslib\";\nimport { WHITE_SPACE_REGEX } from './regex.generated';\nexport function parseNumberSkeletonFromString(skeleton) {\n if (skeleton.length === 0) {\n throw new Error('Number skeleton cannot be empty');\n }\n // Parse the skeleton\n var stringTokens = skeleton\n .split(WHITE_SPACE_REGEX)\n .filter(function (x) { return x.length > 0; });\n var tokens = [];\n for (var _i = 0, stringTokens_1 = stringTokens; _i < stringTokens_1.length; _i++) {\n var stringToken = stringTokens_1[_i];\n var stemAndOptions = stringToken.split('/');\n if (stemAndOptions.length === 0) {\n throw new Error('Invalid number skeleton');\n }\n var stem = stemAndOptions[0], options = stemAndOptions.slice(1);\n for (var _a = 0, options_1 = options; _a < options_1.length; _a++) {\n var option = options_1[_a];\n if (option.length === 0) {\n throw new Error('Invalid number skeleton');\n }\n }\n tokens.push({ stem: stem, options: options });\n }\n return tokens;\n}\nfunction icuUnitToEcma(unit) {\n return unit.replace(/^(.*?)-/, '');\n}\nvar FRACTION_PRECISION_REGEX = /^\\.(?:(0+)(\\*)?|(#+)|(0+)(#+))$/g;\nvar SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\\+|#+)?[rs]?$/g;\nvar INTEGER_WIDTH_REGEX = /(\\*)(0+)|(#+)(0+)|(0+)/g;\nvar CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;\nfunction parseSignificantPrecision(str) {\n var result = {};\n if (str[str.length - 1] === 'r') {\n result.roundingPriority = 'morePrecision';\n }\n else if (str[str.length - 1] === 's') {\n result.roundingPriority = 'lessPrecision';\n }\n str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) {\n // @@@ case\n if (typeof g2 !== 'string') {\n result.minimumSignificantDigits = g1.length;\n result.maximumSignificantDigits = g1.length;\n }\n // @@@+ case\n else if (g2 === '+') {\n result.minimumSignificantDigits = g1.length;\n }\n // .### case\n else if (g1[0] === '#') {\n result.maximumSignificantDigits = g1.length;\n }\n // .@@## or .@@@ case\n else {\n result.minimumSignificantDigits = g1.length;\n result.maximumSignificantDigits =\n g1.length + (typeof g2 === 'string' ? g2.length : 0);\n }\n return '';\n });\n return result;\n}\nfunction parseSign(str) {\n switch (str) {\n case 'sign-auto':\n return {\n signDisplay: 'auto',\n };\n case 'sign-accounting':\n case '()':\n return {\n currencySign: 'accounting',\n };\n case 'sign-always':\n case '+!':\n return {\n signDisplay: 'always',\n };\n case 'sign-accounting-always':\n case '()!':\n return {\n signDisplay: 'always',\n currencySign: 'accounting',\n };\n case 'sign-except-zero':\n case '+?':\n return {\n signDisplay: 'exceptZero',\n };\n case 'sign-accounting-except-zero':\n case '()?':\n return {\n signDisplay: 'exceptZero',\n currencySign: 'accounting',\n };\n case 'sign-never':\n case '+_':\n return {\n signDisplay: 'never',\n };\n }\n}\nfunction parseConciseScientificAndEngineeringStem(stem) {\n // Engineering\n var result;\n if (stem[0] === 'E' && stem[1] === 'E') {\n result = {\n notation: 'engineering',\n };\n stem = stem.slice(2);\n }\n else if (stem[0] === 'E') {\n result = {\n notation: 'scientific',\n };\n stem = stem.slice(1);\n }\n if (result) {\n var signDisplay = stem.slice(0, 2);\n if (signDisplay === '+!') {\n result.signDisplay = 'always';\n stem = stem.slice(2);\n }\n else if (signDisplay === '+?') {\n result.signDisplay = 'exceptZero';\n stem = stem.slice(2);\n }\n if (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) {\n throw new Error('Malformed concise eng/scientific notation');\n }\n result.minimumIntegerDigits = stem.length;\n }\n return result;\n}\nfunction parseNotationOptions(opt) {\n var result = {};\n var signOpts = parseSign(opt);\n if (signOpts) {\n return signOpts;\n }\n return result;\n}\n/**\n * https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options\n */\nexport function parseNumberSkeleton(tokens) {\n var result = {};\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n switch (token.stem) {\n case 'percent':\n case '%':\n result.style = 'percent';\n continue;\n case '%x100':\n result.style = 'percent';\n result.scale = 100;\n continue;\n case 'currency':\n result.style = 'currency';\n result.currency = token.options[0];\n continue;\n case 'group-off':\n case ',_':\n result.useGrouping = false;\n continue;\n case 'precision-integer':\n case '.':\n result.maximumFractionDigits = 0;\n continue;\n case 'measure-unit':\n case 'unit':\n result.style = 'unit';\n result.unit = icuUnitToEcma(token.options[0]);\n continue;\n case 'compact-short':\n case 'K':\n result.notation = 'compact';\n result.compactDisplay = 'short';\n continue;\n case 'compact-long':\n case 'KK':\n result.notation = 'compact';\n result.compactDisplay = 'long';\n continue;\n case 'scientific':\n result = __assign(__assign(__assign({}, result), { notation: 'scientific' }), token.options.reduce(function (all, opt) { return (__assign(__assign({}, all), parseNotationOptions(opt))); }, {}));\n continue;\n case 'engineering':\n result = __assign(__assign(__assign({}, result), { notation: 'engineering' }), token.options.reduce(function (all, opt) { return (__assign(__assign({}, all), parseNotationOptions(opt))); }, {}));\n continue;\n case 'notation-simple':\n result.notation = 'standard';\n continue;\n // https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h\n case 'unit-width-narrow':\n result.currencyDisplay = 'narrowSymbol';\n result.unitDisplay = 'narrow';\n continue;\n case 'unit-width-short':\n result.currencyDisplay = 'code';\n result.unitDisplay = 'short';\n continue;\n case 'unit-width-full-name':\n result.currencyDisplay = 'name';\n result.unitDisplay = 'long';\n continue;\n case 'unit-width-iso-code':\n result.currencyDisplay = 'symbol';\n continue;\n case 'scale':\n result.scale = parseFloat(token.options[0]);\n continue;\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width\n case 'integer-width':\n if (token.options.length > 1) {\n throw new RangeError('integer-width stems only accept a single optional option');\n }\n token.options[0].replace(INTEGER_WIDTH_REGEX, function (_, g1, g2, g3, g4, g5) {\n if (g1) {\n result.minimumIntegerDigits = g2.length;\n }\n else if (g3 && g4) {\n throw new Error('We currently do not support maximum integer digits');\n }\n else if (g5) {\n throw new Error('We currently do not support exact integer digits');\n }\n return '';\n });\n continue;\n }\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width\n if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {\n result.minimumIntegerDigits = token.stem.length;\n continue;\n }\n if (FRACTION_PRECISION_REGEX.test(token.stem)) {\n // Precision\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#fraction-precision\n // precision-integer case\n if (token.options.length > 1) {\n throw new RangeError('Fraction-precision stems only accept a single optional option');\n }\n token.stem.replace(FRACTION_PRECISION_REGEX, function (_, g1, g2, g3, g4, g5) {\n // .000* case (before ICU67 it was .000+)\n if (g2 === '*') {\n result.minimumFractionDigits = g1.length;\n }\n // .### case\n else if (g3 && g3[0] === '#') {\n result.maximumFractionDigits = g3.length;\n }\n // .00## case\n else if (g4 && g5) {\n result.minimumFractionDigits = g4.length;\n result.maximumFractionDigits = g4.length + g5.length;\n }\n else {\n result.minimumFractionDigits = g1.length;\n result.maximumFractionDigits = g1.length;\n }\n return '';\n });\n var opt = token.options[0];\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display\n if (opt === 'w') {\n result = __assign(__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' });\n }\n else if (opt) {\n result = __assign(__assign({}, result), parseSignificantPrecision(opt));\n }\n continue;\n }\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#significant-digits-precision\n if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {\n result = __assign(__assign({}, result), parseSignificantPrecision(token.stem));\n continue;\n }\n var signOpts = parseSign(token.stem);\n if (signOpts) {\n result = __assign(__assign({}, result), signOpts);\n }\n var conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);\n if (conciseScientificAndEngineeringOpts) {\n result = __assign(__assign({}, result), conciseScientificAndEngineeringOpts);\n }\n }\n return result;\n}\n","// @generated from time-data-gen.ts\n// prettier-ignore \nexport var timeData = {\n \"AX\": [\n \"H\"\n ],\n \"BQ\": [\n \"H\"\n ],\n \"CP\": [\n \"H\"\n ],\n \"CZ\": [\n \"H\"\n ],\n \"DK\": [\n \"H\"\n ],\n \"FI\": [\n \"H\"\n ],\n \"ID\": [\n \"H\"\n ],\n \"IS\": [\n \"H\"\n ],\n \"ML\": [\n \"H\"\n ],\n \"NE\": [\n \"H\"\n ],\n \"RU\": [\n \"H\"\n ],\n \"SE\": [\n \"H\"\n ],\n \"SJ\": [\n \"H\"\n ],\n \"SK\": [\n \"H\"\n ],\n \"AS\": [\n \"h\",\n \"H\"\n ],\n \"BT\": [\n \"h\",\n \"H\"\n ],\n \"DJ\": [\n \"h\",\n \"H\"\n ],\n \"ER\": [\n \"h\",\n \"H\"\n ],\n \"GH\": [\n \"h\",\n \"H\"\n ],\n \"IN\": [\n \"h\",\n \"H\"\n ],\n \"LS\": [\n \"h\",\n \"H\"\n ],\n \"PG\": [\n \"h\",\n \"H\"\n ],\n \"PW\": [\n \"h\",\n \"H\"\n ],\n \"SO\": [\n \"h\",\n \"H\"\n ],\n \"TO\": [\n \"h\",\n \"H\"\n ],\n \"VU\": [\n \"h\",\n \"H\"\n ],\n \"WS\": [\n \"h\",\n \"H\"\n ],\n \"001\": [\n \"H\",\n \"h\"\n ],\n \"AL\": [\n \"h\",\n \"H\",\n \"hB\"\n ],\n \"TD\": [\n \"h\",\n \"H\",\n \"hB\"\n ],\n \"ca-ES\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"CF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"CM\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"fr-CA\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"gl-ES\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"it-CH\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"it-IT\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"LU\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"NP\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"PF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SC\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SM\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SN\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"TF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"VA\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"CY\": [\n \"h\",\n \"H\",\n \"hb\",\n \"hB\"\n ],\n \"GR\": [\n \"h\",\n \"H\",\n \"hb\",\n \"hB\"\n ],\n \"CO\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"DO\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"KP\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"KR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"NA\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"PA\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"PR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"VE\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"AC\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"AI\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"BW\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"BZ\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CC\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CX\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"DG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"FK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GB\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GI\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IE\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IM\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IO\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"JE\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"LT\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"MK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"MN\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"MS\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NF\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NR\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NU\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"PN\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"SH\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"SX\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"TA\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"ZA\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"af-ZA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"AR\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"CL\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"CR\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"CU\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"EA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-BO\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-BR\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-EC\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-ES\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-GQ\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-PE\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"GT\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"HN\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"IC\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"KG\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"KM\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"LK\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"MA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"MX\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"NI\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"PY\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"SV\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"UY\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"JP\": [\n \"H\",\n \"h\",\n \"K\"\n ],\n \"AD\": [\n \"H\",\n \"hB\"\n ],\n \"AM\": [\n \"H\",\n \"hB\"\n ],\n \"AO\": [\n \"H\",\n \"hB\"\n ],\n \"AT\": [\n \"H\",\n \"hB\"\n ],\n \"AW\": [\n \"H\",\n \"hB\"\n ],\n \"BE\": [\n \"H\",\n \"hB\"\n ],\n \"BF\": [\n \"H\",\n \"hB\"\n ],\n \"BJ\": [\n \"H\",\n \"hB\"\n ],\n \"BL\": [\n \"H\",\n \"hB\"\n ],\n \"BR\": [\n \"H\",\n \"hB\"\n ],\n \"CG\": [\n \"H\",\n \"hB\"\n ],\n \"CI\": [\n \"H\",\n \"hB\"\n ],\n \"CV\": [\n \"H\",\n \"hB\"\n ],\n \"DE\": [\n \"H\",\n \"hB\"\n ],\n \"EE\": [\n \"H\",\n \"hB\"\n ],\n \"FR\": [\n \"H\",\n \"hB\"\n ],\n \"GA\": [\n \"H\",\n \"hB\"\n ],\n \"GF\": [\n \"H\",\n \"hB\"\n ],\n \"GN\": [\n \"H\",\n \"hB\"\n ],\n \"GP\": [\n \"H\",\n \"hB\"\n ],\n \"GW\": [\n \"H\",\n \"hB\"\n ],\n \"HR\": [\n \"H\",\n \"hB\"\n ],\n \"IL\": [\n \"H\",\n \"hB\"\n ],\n \"IT\": [\n \"H\",\n \"hB\"\n ],\n \"KZ\": [\n \"H\",\n \"hB\"\n ],\n \"MC\": [\n \"H\",\n \"hB\"\n ],\n \"MD\": [\n \"H\",\n \"hB\"\n ],\n \"MF\": [\n \"H\",\n \"hB\"\n ],\n \"MQ\": [\n \"H\",\n \"hB\"\n ],\n \"MZ\": [\n \"H\",\n \"hB\"\n ],\n \"NC\": [\n \"H\",\n \"hB\"\n ],\n \"NL\": [\n \"H\",\n \"hB\"\n ],\n \"PM\": [\n \"H\",\n \"hB\"\n ],\n \"PT\": [\n \"H\",\n \"hB\"\n ],\n \"RE\": [\n \"H\",\n \"hB\"\n ],\n \"RO\": [\n \"H\",\n \"hB\"\n ],\n \"SI\": [\n \"H\",\n \"hB\"\n ],\n \"SR\": [\n \"H\",\n \"hB\"\n ],\n \"ST\": [\n \"H\",\n \"hB\"\n ],\n \"TG\": [\n \"H\",\n \"hB\"\n ],\n \"TR\": [\n \"H\",\n \"hB\"\n ],\n \"WF\": [\n \"H\",\n \"hB\"\n ],\n \"YT\": [\n \"H\",\n \"hB\"\n ],\n \"BD\": [\n \"h\",\n \"hB\",\n \"H\"\n ],\n \"PK\": [\n \"h\",\n \"hB\",\n \"H\"\n ],\n \"AZ\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"BA\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"BG\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"CH\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"GE\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"LI\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"ME\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"RS\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"UA\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"UZ\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"XK\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"AG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"AU\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BB\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BS\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"CA\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"DM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"en-001\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"FJ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"FM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GD\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GU\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GY\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"JM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KI\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KN\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KY\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"LC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"LR\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MH\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MP\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MW\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"NZ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SB\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SL\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SS\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SZ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"TC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"TT\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"UM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"US\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VI\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"ZM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BO\": [\n \"H\",\n \"hB\",\n \"h\",\n \"hb\"\n ],\n \"EC\": [\n \"H\",\n \"hB\",\n \"h\",\n \"hb\"\n ],\n \"ES\": [\n \"H\",\n \"hB\",\n \"h\",\n \"hb\"\n ],\n \"GQ\": [\n \"H\",\n \"hB\",\n \"h\",\n \"hb\"\n ],\n \"PE\": [\n \"H\",\n \"hB\",\n \"h\",\n \"hb\"\n ],\n \"AE\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"ar-001\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"BH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"DZ\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"EG\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"EH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"HK\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"IQ\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"JO\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"KW\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"LB\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"LY\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"MO\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"MR\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"OM\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"PH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"PS\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"QA\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SA\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SD\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SY\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"TN\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"YE\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"AF\": [\n \"H\",\n \"hb\",\n \"hB\",\n \"h\"\n ],\n \"LA\": [\n \"H\",\n \"hb\",\n \"hB\",\n \"h\"\n ],\n \"CN\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"LV\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"TL\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"zu-ZA\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"CD\": [\n \"hB\",\n \"H\"\n ],\n \"IR\": [\n \"hB\",\n \"H\"\n ],\n \"hi-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"kn-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"ml-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"te-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"KH\": [\n \"hB\",\n \"h\",\n \"H\",\n \"hb\"\n ],\n \"ta-IN\": [\n \"hB\",\n \"h\",\n \"hb\",\n \"H\"\n ],\n \"BN\": [\n \"hb\",\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"MY\": [\n \"hb\",\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"ET\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"gu-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"mr-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"pa-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"TW\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"KE\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"MM\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"TZ\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"UG\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ]\n};\n","import { timeData } from './time-data.generated';\n/**\n * Returns the best matching date time pattern if a date time skeleton\n * pattern is provided with a locale. Follows the Unicode specification:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns\n * @param skeleton date time skeleton pattern that possibly includes j, J or C\n * @param locale\n */\nexport function getBestPattern(skeleton, locale) {\n var skeletonCopy = '';\n for (var patternPos = 0; patternPos < skeleton.length; patternPos++) {\n var patternChar = skeleton.charAt(patternPos);\n if (patternChar === 'j') {\n var extraLength = 0;\n while (patternPos + 1 < skeleton.length &&\n skeleton.charAt(patternPos + 1) === patternChar) {\n extraLength++;\n patternPos++;\n }\n var hourLen = 1 + (extraLength & 1);\n var dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);\n var dayPeriodChar = 'a';\n var hourChar = getDefaultHourSymbolFromLocale(locale);\n if (hourChar == 'H' || hourChar == 'k') {\n dayPeriodLen = 0;\n }\n while (dayPeriodLen-- > 0) {\n skeletonCopy += dayPeriodChar;\n }\n while (hourLen-- > 0) {\n skeletonCopy = hourChar + skeletonCopy;\n }\n }\n else if (patternChar === 'J') {\n skeletonCopy += 'H';\n }\n else {\n skeletonCopy += patternChar;\n }\n }\n return skeletonCopy;\n}\n/**\n * Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)\n * of the given `locale` to the corresponding time pattern.\n * @param locale\n */\nfunction getDefaultHourSymbolFromLocale(locale) {\n var hourCycle = locale.hourCycle;\n if (hourCycle === undefined &&\n // @ts-ignore hourCycle(s) is not identified yet\n locale.hourCycles &&\n // @ts-ignore\n locale.hourCycles.length) {\n // @ts-ignore\n hourCycle = locale.hourCycles[0];\n }\n if (hourCycle) {\n switch (hourCycle) {\n case 'h24':\n return 'k';\n case 'h23':\n return 'H';\n case 'h12':\n return 'h';\n case 'h11':\n return 'K';\n default:\n throw new Error('Invalid hourCycle');\n }\n }\n // TODO: Once hourCycle is fully supported remove the following with data generation\n var languageTag = locale.language;\n var regionTag;\n if (languageTag !== 'root') {\n regionTag = locale.maximize().region;\n }\n var hourCycles = timeData[regionTag || ''] ||\n timeData[languageTag || ''] ||\n timeData[\"\".concat(languageTag, \"-001\")] ||\n timeData['001'];\n return hourCycles[0];\n}\n","var _a;\nimport { __assign } from \"tslib\";\nimport { ErrorKind } from './error';\nimport { SKELETON_TYPE, TYPE, } from './types';\nimport { SPACE_SEPARATOR_REGEX } from './regex.generated';\nimport { parseNumberSkeleton, parseNumberSkeletonFromString, parseDateTimeSkeleton, } from '@formatjs/icu-skeleton-parser';\nimport { getBestPattern } from './date-time-pattern-generator';\nvar SPACE_SEPARATOR_START_REGEX = new RegExp(\"^\".concat(SPACE_SEPARATOR_REGEX.source, \"*\"));\nvar SPACE_SEPARATOR_END_REGEX = new RegExp(\"\".concat(SPACE_SEPARATOR_REGEX.source, \"*$\"));\nfunction createLocation(start, end) {\n return { start: start, end: end };\n}\n// #region Ponyfills\n// Consolidate these variables up top for easier toggling during debugging\nvar hasNativeStartsWith = !!String.prototype.startsWith;\nvar hasNativeFromCodePoint = !!String.fromCodePoint;\nvar hasNativeFromEntries = !!Object.fromEntries;\nvar hasNativeCodePointAt = !!String.prototype.codePointAt;\nvar hasTrimStart = !!String.prototype.trimStart;\nvar hasTrimEnd = !!String.prototype.trimEnd;\nvar hasNativeIsSafeInteger = !!Number.isSafeInteger;\nvar isSafeInteger = hasNativeIsSafeInteger\n ? Number.isSafeInteger\n : function (n) {\n return (typeof n === 'number' &&\n isFinite(n) &&\n Math.floor(n) === n &&\n Math.abs(n) <= 0x1fffffffffffff);\n };\n// IE11 does not support y and u.\nvar REGEX_SUPPORTS_U_AND_Y = true;\ntry {\n var re = RE('([^\\\\p{White_Space}\\\\p{Pattern_Syntax}]*)', 'yu');\n /**\n * legacy Edge or Xbox One browser\n * Unicode flag support: supported\n * Pattern_Syntax support: not supported\n * See https://github.com/formatjs/formatjs/issues/2822\n */\n REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec('a')) === null || _a === void 0 ? void 0 : _a[0]) === 'a';\n}\ncatch (_) {\n REGEX_SUPPORTS_U_AND_Y = false;\n}\nvar startsWith = hasNativeStartsWith\n ? // Native\n function startsWith(s, search, position) {\n return s.startsWith(search, position);\n }\n : // For IE11\n function startsWith(s, search, position) {\n return s.slice(position, position + search.length) === search;\n };\nvar fromCodePoint = hasNativeFromCodePoint\n ? String.fromCodePoint\n : // IE11\n function fromCodePoint() {\n var codePoints = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n codePoints[_i] = arguments[_i];\n }\n var elements = '';\n var length = codePoints.length;\n var i = 0;\n var code;\n while (length > i) {\n code = codePoints[i++];\n if (code > 0x10ffff)\n throw RangeError(code + ' is not a valid code point');\n elements +=\n code < 0x10000\n ? String.fromCharCode(code)\n : String.fromCharCode(((code -= 0x10000) >> 10) + 0xd800, (code % 0x400) + 0xdc00);\n }\n return elements;\n };\nvar fromEntries = \n// native\nhasNativeFromEntries\n ? Object.fromEntries\n : // Ponyfill\n function fromEntries(entries) {\n var obj = {};\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var _a = entries_1[_i], k = _a[0], v = _a[1];\n obj[k] = v;\n }\n return obj;\n };\nvar codePointAt = hasNativeCodePointAt\n ? // Native\n function codePointAt(s, index) {\n return s.codePointAt(index);\n }\n : // IE 11\n function codePointAt(s, index) {\n var size = s.length;\n if (index < 0 || index >= size) {\n return undefined;\n }\n var first = s.charCodeAt(index);\n var second;\n return first < 0xd800 ||\n first > 0xdbff ||\n index + 1 === size ||\n (second = s.charCodeAt(index + 1)) < 0xdc00 ||\n second > 0xdfff\n ? first\n : ((first - 0xd800) << 10) + (second - 0xdc00) + 0x10000;\n };\nvar trimStart = hasTrimStart\n ? // Native\n function trimStart(s) {\n return s.trimStart();\n }\n : // Ponyfill\n function trimStart(s) {\n return s.replace(SPACE_SEPARATOR_START_REGEX, '');\n };\nvar trimEnd = hasTrimEnd\n ? // Native\n function trimEnd(s) {\n return s.trimEnd();\n }\n : // Ponyfill\n function trimEnd(s) {\n return s.replace(SPACE_SEPARATOR_END_REGEX, '');\n };\n// Prevent minifier to translate new RegExp to literal form that might cause syntax error on IE11.\nfunction RE(s, flag) {\n return new RegExp(s, flag);\n}\n// #endregion\nvar matchIdentifierAtIndex;\nif (REGEX_SUPPORTS_U_AND_Y) {\n // Native\n var IDENTIFIER_PREFIX_RE_1 = RE('([^\\\\p{White_Space}\\\\p{Pattern_Syntax}]*)', 'yu');\n matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {\n var _a;\n IDENTIFIER_PREFIX_RE_1.lastIndex = index;\n var match = IDENTIFIER_PREFIX_RE_1.exec(s);\n return (_a = match[1]) !== null && _a !== void 0 ? _a : '';\n };\n}\nelse {\n // IE11\n matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {\n var match = [];\n while (true) {\n var c = codePointAt(s, index);\n if (c === undefined || _isWhiteSpace(c) || _isPatternSyntax(c)) {\n break;\n }\n match.push(c);\n index += c >= 0x10000 ? 2 : 1;\n }\n return fromCodePoint.apply(void 0, match);\n };\n}\nvar Parser = /** @class */ (function () {\n function Parser(message, options) {\n if (options === void 0) { options = {}; }\n this.message = message;\n this.position = { offset: 0, line: 1, column: 1 };\n this.ignoreTag = !!options.ignoreTag;\n this.locale = options.locale;\n this.requiresOtherClause = !!options.requiresOtherClause;\n this.shouldParseSkeletons = !!options.shouldParseSkeletons;\n }\n Parser.prototype.parse = function () {\n if (this.offset() !== 0) {\n throw Error('parser can only be used once');\n }\n return this.parseMessage(0, '', false);\n };\n Parser.prototype.parseMessage = function (nestingLevel, parentArgType, expectingCloseTag) {\n var elements = [];\n while (!this.isEOF()) {\n var char = this.char();\n if (char === 123 /* `{` */) {\n var result = this.parseArgument(nestingLevel, expectingCloseTag);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n else if (char === 125 /* `}` */ && nestingLevel > 0) {\n break;\n }\n else if (char === 35 /* `#` */ &&\n (parentArgType === 'plural' || parentArgType === 'selectordinal')) {\n var position = this.clonePosition();\n this.bump();\n elements.push({\n type: TYPE.pound,\n location: createLocation(position, this.clonePosition()),\n });\n }\n else if (char === 60 /* `<` */ &&\n !this.ignoreTag &&\n this.peek() === 47 // char code for '/'\n ) {\n if (expectingCloseTag) {\n break;\n }\n else {\n return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));\n }\n }\n else if (char === 60 /* `<` */ &&\n !this.ignoreTag &&\n _isAlpha(this.peek() || 0)) {\n var result = this.parseTag(nestingLevel, parentArgType);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n else {\n var result = this.parseLiteral(nestingLevel, parentArgType);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n }\n return { val: elements, err: null };\n };\n /**\n * A tag name must start with an ASCII lower/upper case letter. The grammar is based on the\n * [custom element name][] except that a dash is NOT always mandatory and uppercase letters\n * are accepted:\n *\n * ```\n * tag ::= \"<\" tagName (whitespace)* \"/>\" | \"<\" tagName (whitespace)* \">\" message \"\"\n * tagName ::= [a-z] (PENChar)*\n * PENChar ::=\n * \"-\" | \".\" | [0-9] | \"_\" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |\n * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |\n * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n * ```\n *\n * [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n * NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do\n * since other tag-based engines like React allow it\n */\n Parser.prototype.parseTag = function (nestingLevel, parentArgType) {\n var startPosition = this.clonePosition();\n this.bump(); // `<`\n var tagName = this.parseTagName();\n this.bumpSpace();\n if (this.bumpIf('/>')) {\n // Self closing tag\n return {\n val: {\n type: TYPE.literal,\n value: \"<\".concat(tagName, \"/>\"),\n location: createLocation(startPosition, this.clonePosition()),\n },\n err: null,\n };\n }\n else if (this.bumpIf('>')) {\n var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);\n if (childrenResult.err) {\n return childrenResult;\n }\n var children = childrenResult.val;\n // Expecting a close tag\n var endTagStartPosition = this.clonePosition();\n if (this.bumpIf('')) {\n return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));\n }\n return {\n val: {\n type: TYPE.tag,\n value: tagName,\n children: children,\n location: createLocation(startPosition, this.clonePosition()),\n },\n err: null,\n };\n }\n else {\n return this.error(ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition()));\n }\n }\n else {\n return this.error(ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition()));\n }\n };\n /**\n * This method assumes that the caller has peeked ahead for the first tag character.\n */\n Parser.prototype.parseTagName = function () {\n var startOffset = this.offset();\n this.bump(); // the first tag name character\n while (!this.isEOF() && _isPotentialElementNameChar(this.char())) {\n this.bump();\n }\n return this.message.slice(startOffset, this.offset());\n };\n Parser.prototype.parseLiteral = function (nestingLevel, parentArgType) {\n var start = this.clonePosition();\n var value = '';\n while (true) {\n var parseQuoteResult = this.tryParseQuote(parentArgType);\n if (parseQuoteResult) {\n value += parseQuoteResult;\n continue;\n }\n var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);\n if (parseUnquotedResult) {\n value += parseUnquotedResult;\n continue;\n }\n var parseLeftAngleResult = this.tryParseLeftAngleBracket();\n if (parseLeftAngleResult) {\n value += parseLeftAngleResult;\n continue;\n }\n break;\n }\n var location = createLocation(start, this.clonePosition());\n return {\n val: { type: TYPE.literal, value: value, location: location },\n err: null,\n };\n };\n Parser.prototype.tryParseLeftAngleBracket = function () {\n if (!this.isEOF() &&\n this.char() === 60 /* `<` */ &&\n (this.ignoreTag ||\n // If at the opening tag or closing tag position, bail.\n !_isAlphaOrSlash(this.peek() || 0))) {\n this.bump(); // `<`\n return '<';\n }\n return null;\n };\n /**\n * Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes\n * a character that requires quoting (that is, \"only where needed\"), and works the same in\n * nested messages as on the top level of the pattern. The new behavior is otherwise compatible.\n */\n Parser.prototype.tryParseQuote = function (parentArgType) {\n if (this.isEOF() || this.char() !== 39 /* `'` */) {\n return null;\n }\n // Parse escaped char following the apostrophe, or early return if there is no escaped char.\n // Check if is valid escaped character\n switch (this.peek()) {\n case 39 /* `'` */:\n // double quote, should return as a single quote.\n this.bump();\n this.bump();\n return \"'\";\n // '{', '<', '>', '}'\n case 123:\n case 60:\n case 62:\n case 125:\n break;\n case 35: // '#'\n if (parentArgType === 'plural' || parentArgType === 'selectordinal') {\n break;\n }\n return null;\n default:\n return null;\n }\n this.bump(); // apostrophe\n var codePoints = [this.char()]; // escaped char\n this.bump();\n // read chars until the optional closing apostrophe is found\n while (!this.isEOF()) {\n var ch = this.char();\n if (ch === 39 /* `'` */) {\n if (this.peek() === 39 /* `'` */) {\n codePoints.push(39);\n // Bump one more time because we need to skip 2 characters.\n this.bump();\n }\n else {\n // Optional closing apostrophe.\n this.bump();\n break;\n }\n }\n else {\n codePoints.push(ch);\n }\n this.bump();\n }\n return fromCodePoint.apply(void 0, codePoints);\n };\n Parser.prototype.tryParseUnquoted = function (nestingLevel, parentArgType) {\n if (this.isEOF()) {\n return null;\n }\n var ch = this.char();\n if (ch === 60 /* `<` */ ||\n ch === 123 /* `{` */ ||\n (ch === 35 /* `#` */ &&\n (parentArgType === 'plural' || parentArgType === 'selectordinal')) ||\n (ch === 125 /* `}` */ && nestingLevel > 0)) {\n return null;\n }\n else {\n this.bump();\n return fromCodePoint(ch);\n }\n };\n Parser.prototype.parseArgument = function (nestingLevel, expectingCloseTag) {\n var openingBracePosition = this.clonePosition();\n this.bump(); // `{`\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n if (this.char() === 125 /* `}` */) {\n this.bump();\n return this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n // argument name\n var value = this.parseIdentifierIfPossible().value;\n if (!value) {\n return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n switch (this.char()) {\n // Simple argument: `{name}`\n case 125 /* `}` */: {\n this.bump(); // `}`\n return {\n val: {\n type: TYPE.argument,\n // value does not include the opening and closing braces.\n value: value,\n location: createLocation(openingBracePosition, this.clonePosition()),\n },\n err: null,\n };\n }\n // Argument with options: `{name, format, ...}`\n case 44 /* `,` */: {\n this.bump(); // `,`\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);\n }\n default:\n return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n };\n /**\n * Advance the parser until the end of the identifier, if it is currently on\n * an identifier character. Return an empty string otherwise.\n */\n Parser.prototype.parseIdentifierIfPossible = function () {\n var startingPosition = this.clonePosition();\n var startOffset = this.offset();\n var value = matchIdentifierAtIndex(this.message, startOffset);\n var endOffset = startOffset + value.length;\n this.bumpTo(endOffset);\n var endPosition = this.clonePosition();\n var location = createLocation(startingPosition, endPosition);\n return { value: value, location: location };\n };\n Parser.prototype.parseArgumentOptions = function (nestingLevel, expectingCloseTag, value, openingBracePosition) {\n var _a;\n // Parse this range:\n // {name, type, style}\n // ^---^\n var typeStartPosition = this.clonePosition();\n var argType = this.parseIdentifierIfPossible().value;\n var typeEndPosition = this.clonePosition();\n switch (argType) {\n case '':\n // Expecting a style string number, date, time, plural, selectordinal, or select.\n return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));\n case 'number':\n case 'date':\n case 'time': {\n // Parse this range:\n // {name, number, style}\n // ^-------^\n this.bumpSpace();\n var styleAndLocation = null;\n if (this.bumpIf(',')) {\n this.bumpSpace();\n var styleStartPosition = this.clonePosition();\n var result = this.parseSimpleArgStyleIfPossible();\n if (result.err) {\n return result;\n }\n var style = trimEnd(result.val);\n if (style.length === 0) {\n return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n var styleLocation = createLocation(styleStartPosition, this.clonePosition());\n styleAndLocation = { style: style, styleLocation: styleLocation };\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n var location_1 = createLocation(openingBracePosition, this.clonePosition());\n // Extract style or skeleton\n if (styleAndLocation && startsWith(styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style, '::', 0)) {\n // Skeleton starts with `::`.\n var skeleton = trimStart(styleAndLocation.style.slice(2));\n if (argType === 'number') {\n var result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);\n if (result.err) {\n return result;\n }\n return {\n val: { type: TYPE.number, value: value, location: location_1, style: result.val },\n err: null,\n };\n }\n else {\n if (skeleton.length === 0) {\n return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location_1);\n }\n var dateTimePattern = skeleton;\n // Get \"best match\" pattern only if locale is passed, if not, let it\n // pass as-is where `parseDateTimeSkeleton()` will throw an error\n // for unsupported patterns.\n if (this.locale) {\n dateTimePattern = getBestPattern(skeleton, this.locale);\n }\n var style = {\n type: SKELETON_TYPE.dateTime,\n pattern: dateTimePattern,\n location: styleAndLocation.styleLocation,\n parsedOptions: this.shouldParseSkeletons\n ? parseDateTimeSkeleton(dateTimePattern)\n : {},\n };\n var type = argType === 'date' ? TYPE.date : TYPE.time;\n return {\n val: { type: type, value: value, location: location_1, style: style },\n err: null,\n };\n }\n }\n // Regular style or no style.\n return {\n val: {\n type: argType === 'number'\n ? TYPE.number\n : argType === 'date'\n ? TYPE.date\n : TYPE.time,\n value: value,\n location: location_1,\n style: (_a = styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style) !== null && _a !== void 0 ? _a : null,\n },\n err: null,\n };\n }\n case 'plural':\n case 'selectordinal':\n case 'select': {\n // Parse this range:\n // {name, plural, options}\n // ^---------^\n var typeEndPosition_1 = this.clonePosition();\n this.bumpSpace();\n if (!this.bumpIf(',')) {\n return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition_1, __assign({}, typeEndPosition_1)));\n }\n this.bumpSpace();\n // Parse offset:\n // {name, plural, offset:1, options}\n // ^-----^\n //\n // or the first option:\n //\n // {name, plural, one {...} other {...}}\n // ^--^\n var identifierAndLocation = this.parseIdentifierIfPossible();\n var pluralOffset = 0;\n if (argType !== 'select' && identifierAndLocation.value === 'offset') {\n if (!this.bumpIf(':')) {\n return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n this.bumpSpace();\n var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);\n if (result.err) {\n return result;\n }\n // Parse another identifier for option parsing\n this.bumpSpace();\n identifierAndLocation = this.parseIdentifierIfPossible();\n pluralOffset = result.val;\n }\n var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);\n if (optionsResult.err) {\n return optionsResult;\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n var location_2 = createLocation(openingBracePosition, this.clonePosition());\n if (argType === 'select') {\n return {\n val: {\n type: TYPE.select,\n value: value,\n options: fromEntries(optionsResult.val),\n location: location_2,\n },\n err: null,\n };\n }\n else {\n return {\n val: {\n type: TYPE.plural,\n value: value,\n options: fromEntries(optionsResult.val),\n offset: pluralOffset,\n pluralType: argType === 'plural' ? 'cardinal' : 'ordinal',\n location: location_2,\n },\n err: null,\n };\n }\n }\n default:\n return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));\n }\n };\n Parser.prototype.tryParseArgumentClose = function (openingBracePosition) {\n // Parse: {value, number, ::currency/GBP }\n //\n if (this.isEOF() || this.char() !== 125 /* `}` */) {\n return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n this.bump(); // `}`\n return { val: true, err: null };\n };\n /**\n * See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659\n */\n Parser.prototype.parseSimpleArgStyleIfPossible = function () {\n var nestedBraces = 0;\n var startPosition = this.clonePosition();\n while (!this.isEOF()) {\n var ch = this.char();\n switch (ch) {\n case 39 /* `'` */: {\n // Treat apostrophe as quoting but include it in the style part.\n // Find the end of the quoted literal text.\n this.bump();\n var apostrophePosition = this.clonePosition();\n if (!this.bumpUntil(\"'\")) {\n return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));\n }\n this.bump();\n break;\n }\n case 123 /* `{` */: {\n nestedBraces += 1;\n this.bump();\n break;\n }\n case 125 /* `}` */: {\n if (nestedBraces > 0) {\n nestedBraces -= 1;\n }\n else {\n return {\n val: this.message.slice(startPosition.offset, this.offset()),\n err: null,\n };\n }\n break;\n }\n default:\n this.bump();\n break;\n }\n }\n return {\n val: this.message.slice(startPosition.offset, this.offset()),\n err: null,\n };\n };\n Parser.prototype.parseNumberSkeletonFromString = function (skeleton, location) {\n var tokens = [];\n try {\n tokens = parseNumberSkeletonFromString(skeleton);\n }\n catch (e) {\n return this.error(ErrorKind.INVALID_NUMBER_SKELETON, location);\n }\n return {\n val: {\n type: SKELETON_TYPE.number,\n tokens: tokens,\n location: location,\n parsedOptions: this.shouldParseSkeletons\n ? parseNumberSkeleton(tokens)\n : {},\n },\n err: null,\n };\n };\n /**\n * @param nesting_level The current nesting level of messages.\n * This can be positive when parsing message fragment in select or plural argument options.\n * @param parent_arg_type The parent argument's type.\n * @param parsed_first_identifier If provided, this is the first identifier-like selector of\n * the argument. It is a by-product of a previous parsing attempt.\n * @param expecting_close_tag If true, this message is directly or indirectly nested inside\n * between a pair of opening and closing tags. The nested message will not parse beyond\n * the closing tag boundary.\n */\n Parser.prototype.tryParsePluralOrSelectOptions = function (nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {\n var _a;\n var hasOtherClause = false;\n var options = [];\n var parsedSelectors = new Set();\n var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location;\n // Parse:\n // one {one apple}\n // ^--^\n while (true) {\n if (selector.length === 0) {\n var startPosition = this.clonePosition();\n if (parentArgType !== 'select' && this.bumpIf('=')) {\n // Try parse `={number}` selector\n var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);\n if (result.err) {\n return result;\n }\n selectorLocation = createLocation(startPosition, this.clonePosition());\n selector = this.message.slice(startPosition.offset, this.offset());\n }\n else {\n break;\n }\n }\n // Duplicate selector clauses\n if (parsedSelectors.has(selector)) {\n return this.error(parentArgType === 'select'\n ? ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR\n : ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation);\n }\n if (selector === 'other') {\n hasOtherClause = true;\n }\n // Parse:\n // one {one apple}\n // ^----------^\n this.bumpSpace();\n var openingBracePosition = this.clonePosition();\n if (!this.bumpIf('{')) {\n return this.error(parentArgType === 'select'\n ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\n : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));\n }\n var fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);\n if (fragmentResult.err) {\n return fragmentResult;\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n options.push([\n selector,\n {\n value: fragmentResult.val,\n location: createLocation(openingBracePosition, this.clonePosition()),\n },\n ]);\n // Keep track of the existing selectors\n parsedSelectors.add(selector);\n // Prep next selector clause.\n this.bumpSpace();\n (_a = this.parseIdentifierIfPossible(), selector = _a.value, selectorLocation = _a.location);\n }\n if (options.length === 0) {\n return this.error(parentArgType === 'select'\n ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR\n : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition()));\n }\n if (this.requiresOtherClause && !hasOtherClause) {\n return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n return { val: options, err: null };\n };\n Parser.prototype.tryParseDecimalInteger = function (expectNumberError, invalidNumberError) {\n var sign = 1;\n var startingPosition = this.clonePosition();\n if (this.bumpIf('+')) {\n }\n else if (this.bumpIf('-')) {\n sign = -1;\n }\n var hasDigits = false;\n var decimal = 0;\n while (!this.isEOF()) {\n var ch = this.char();\n if (ch >= 48 /* `0` */ && ch <= 57 /* `9` */) {\n hasDigits = true;\n decimal = decimal * 10 + (ch - 48);\n this.bump();\n }\n else {\n break;\n }\n }\n var location = createLocation(startingPosition, this.clonePosition());\n if (!hasDigits) {\n return this.error(expectNumberError, location);\n }\n decimal *= sign;\n if (!isSafeInteger(decimal)) {\n return this.error(invalidNumberError, location);\n }\n return { val: decimal, err: null };\n };\n Parser.prototype.offset = function () {\n return this.position.offset;\n };\n Parser.prototype.isEOF = function () {\n return this.offset() === this.message.length;\n };\n Parser.prototype.clonePosition = function () {\n // This is much faster than `Object.assign` or spread.\n return {\n offset: this.position.offset,\n line: this.position.line,\n column: this.position.column,\n };\n };\n /**\n * Return the code point at the current position of the parser.\n * Throws if the index is out of bound.\n */\n Parser.prototype.char = function () {\n var offset = this.position.offset;\n if (offset >= this.message.length) {\n throw Error('out of bound');\n }\n var code = codePointAt(this.message, offset);\n if (code === undefined) {\n throw Error(\"Offset \".concat(offset, \" is at invalid UTF-16 code unit boundary\"));\n }\n return code;\n };\n Parser.prototype.error = function (kind, location) {\n return {\n val: null,\n err: {\n kind: kind,\n message: this.message,\n location: location,\n },\n };\n };\n /** Bump the parser to the next UTF-16 code unit. */\n Parser.prototype.bump = function () {\n if (this.isEOF()) {\n return;\n }\n var code = this.char();\n if (code === 10 /* '\\n' */) {\n this.position.line += 1;\n this.position.column = 1;\n this.position.offset += 1;\n }\n else {\n this.position.column += 1;\n // 0 ~ 0x10000 -> unicode BMP, otherwise skip the surrogate pair.\n this.position.offset += code < 0x10000 ? 1 : 2;\n }\n };\n /**\n * If the substring starting at the current position of the parser has\n * the given prefix, then bump the parser to the character immediately\n * following the prefix and return true. Otherwise, don't bump the parser\n * and return false.\n */\n Parser.prototype.bumpIf = function (prefix) {\n if (startsWith(this.message, prefix, this.offset())) {\n for (var i = 0; i < prefix.length; i++) {\n this.bump();\n }\n return true;\n }\n return false;\n };\n /**\n * Bump the parser until the pattern character is found and return `true`.\n * Otherwise bump to the end of the file and return `false`.\n */\n Parser.prototype.bumpUntil = function (pattern) {\n var currentOffset = this.offset();\n var index = this.message.indexOf(pattern, currentOffset);\n if (index >= 0) {\n this.bumpTo(index);\n return true;\n }\n else {\n this.bumpTo(this.message.length);\n return false;\n }\n };\n /**\n * Bump the parser to the target offset.\n * If target offset is beyond the end of the input, bump the parser to the end of the input.\n */\n Parser.prototype.bumpTo = function (targetOffset) {\n if (this.offset() > targetOffset) {\n throw Error(\"targetOffset \".concat(targetOffset, \" must be greater than or equal to the current offset \").concat(this.offset()));\n }\n targetOffset = Math.min(targetOffset, this.message.length);\n while (true) {\n var offset = this.offset();\n if (offset === targetOffset) {\n break;\n }\n if (offset > targetOffset) {\n throw Error(\"targetOffset \".concat(targetOffset, \" is at invalid UTF-16 code unit boundary\"));\n }\n this.bump();\n if (this.isEOF()) {\n break;\n }\n }\n };\n /** advance the parser through all whitespace to the next non-whitespace code unit. */\n Parser.prototype.bumpSpace = function () {\n while (!this.isEOF() && _isWhiteSpace(this.char())) {\n this.bump();\n }\n };\n /**\n * Peek at the *next* Unicode codepoint in the input without advancing the parser.\n * If the input has been exhausted, then this returns null.\n */\n Parser.prototype.peek = function () {\n if (this.isEOF()) {\n return null;\n }\n var code = this.char();\n var offset = this.offset();\n var nextCode = this.message.charCodeAt(offset + (code >= 0x10000 ? 2 : 1));\n return nextCode !== null && nextCode !== void 0 ? nextCode : null;\n };\n return Parser;\n}());\nexport { Parser };\n/**\n * This check if codepoint is alphabet (lower & uppercase)\n * @param codepoint\n * @returns\n */\nfunction _isAlpha(codepoint) {\n return ((codepoint >= 97 && codepoint <= 122) ||\n (codepoint >= 65 && codepoint <= 90));\n}\nfunction _isAlphaOrSlash(codepoint) {\n return _isAlpha(codepoint) || codepoint === 47; /* '/' */\n}\n/** See `parseTag` function docs. */\nfunction _isPotentialElementNameChar(c) {\n return (c === 45 /* '-' */ ||\n c === 46 /* '.' */ ||\n (c >= 48 && c <= 57) /* 0..9 */ ||\n c === 95 /* '_' */ ||\n (c >= 97 && c <= 122) /** a..z */ ||\n (c >= 65 && c <= 90) /* A..Z */ ||\n c == 0xb7 ||\n (c >= 0xc0 && c <= 0xd6) ||\n (c >= 0xd8 && c <= 0xf6) ||\n (c >= 0xf8 && c <= 0x37d) ||\n (c >= 0x37f && c <= 0x1fff) ||\n (c >= 0x200c && c <= 0x200d) ||\n (c >= 0x203f && c <= 0x2040) ||\n (c >= 0x2070 && c <= 0x218f) ||\n (c >= 0x2c00 && c <= 0x2fef) ||\n (c >= 0x3001 && c <= 0xd7ff) ||\n (c >= 0xf900 && c <= 0xfdcf) ||\n (c >= 0xfdf0 && c <= 0xfffd) ||\n (c >= 0x10000 && c <= 0xeffff));\n}\n/**\n * Code point equivalent of regex `\\p{White_Space}`.\n * From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt\n */\nfunction _isWhiteSpace(c) {\n return ((c >= 0x0009 && c <= 0x000d) ||\n c === 0x0020 ||\n c === 0x0085 ||\n (c >= 0x200e && c <= 0x200f) ||\n c === 0x2028 ||\n c === 0x2029);\n}\n/**\n * Code point equivalent of regex `\\p{Pattern_Syntax}`.\n * See https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt\n */\nfunction _isPatternSyntax(c) {\n return ((c >= 0x0021 && c <= 0x0023) ||\n c === 0x0024 ||\n (c >= 0x0025 && c <= 0x0027) ||\n c === 0x0028 ||\n c === 0x0029 ||\n c === 0x002a ||\n c === 0x002b ||\n c === 0x002c ||\n c === 0x002d ||\n (c >= 0x002e && c <= 0x002f) ||\n (c >= 0x003a && c <= 0x003b) ||\n (c >= 0x003c && c <= 0x003e) ||\n (c >= 0x003f && c <= 0x0040) ||\n c === 0x005b ||\n c === 0x005c ||\n c === 0x005d ||\n c === 0x005e ||\n c === 0x0060 ||\n c === 0x007b ||\n c === 0x007c ||\n c === 0x007d ||\n c === 0x007e ||\n c === 0x00a1 ||\n (c >= 0x00a2 && c <= 0x00a5) ||\n c === 0x00a6 ||\n c === 0x00a7 ||\n c === 0x00a9 ||\n c === 0x00ab ||\n c === 0x00ac ||\n c === 0x00ae ||\n c === 0x00b0 ||\n c === 0x00b1 ||\n c === 0x00b6 ||\n c === 0x00bb ||\n c === 0x00bf ||\n c === 0x00d7 ||\n c === 0x00f7 ||\n (c >= 0x2010 && c <= 0x2015) ||\n (c >= 0x2016 && c <= 0x2017) ||\n c === 0x2018 ||\n c === 0x2019 ||\n c === 0x201a ||\n (c >= 0x201b && c <= 0x201c) ||\n c === 0x201d ||\n c === 0x201e ||\n c === 0x201f ||\n (c >= 0x2020 && c <= 0x2027) ||\n (c >= 0x2030 && c <= 0x2038) ||\n c === 0x2039 ||\n c === 0x203a ||\n (c >= 0x203b && c <= 0x203e) ||\n (c >= 0x2041 && c <= 0x2043) ||\n c === 0x2044 ||\n c === 0x2045 ||\n c === 0x2046 ||\n (c >= 0x2047 && c <= 0x2051) ||\n c === 0x2052 ||\n c === 0x2053 ||\n (c >= 0x2055 && c <= 0x205e) ||\n (c >= 0x2190 && c <= 0x2194) ||\n (c >= 0x2195 && c <= 0x2199) ||\n (c >= 0x219a && c <= 0x219b) ||\n (c >= 0x219c && c <= 0x219f) ||\n c === 0x21a0 ||\n (c >= 0x21a1 && c <= 0x21a2) ||\n c === 0x21a3 ||\n (c >= 0x21a4 && c <= 0x21a5) ||\n c === 0x21a6 ||\n (c >= 0x21a7 && c <= 0x21ad) ||\n c === 0x21ae ||\n (c >= 0x21af && c <= 0x21cd) ||\n (c >= 0x21ce && c <= 0x21cf) ||\n (c >= 0x21d0 && c <= 0x21d1) ||\n c === 0x21d2 ||\n c === 0x21d3 ||\n c === 0x21d4 ||\n (c >= 0x21d5 && c <= 0x21f3) ||\n (c >= 0x21f4 && c <= 0x22ff) ||\n (c >= 0x2300 && c <= 0x2307) ||\n c === 0x2308 ||\n c === 0x2309 ||\n c === 0x230a ||\n c === 0x230b ||\n (c >= 0x230c && c <= 0x231f) ||\n (c >= 0x2320 && c <= 0x2321) ||\n (c >= 0x2322 && c <= 0x2328) ||\n c === 0x2329 ||\n c === 0x232a ||\n (c >= 0x232b && c <= 0x237b) ||\n c === 0x237c ||\n (c >= 0x237d && c <= 0x239a) ||\n (c >= 0x239b && c <= 0x23b3) ||\n (c >= 0x23b4 && c <= 0x23db) ||\n (c >= 0x23dc && c <= 0x23e1) ||\n (c >= 0x23e2 && c <= 0x2426) ||\n (c >= 0x2427 && c <= 0x243f) ||\n (c >= 0x2440 && c <= 0x244a) ||\n (c >= 0x244b && c <= 0x245f) ||\n (c >= 0x2500 && c <= 0x25b6) ||\n c === 0x25b7 ||\n (c >= 0x25b8 && c <= 0x25c0) ||\n c === 0x25c1 ||\n (c >= 0x25c2 && c <= 0x25f7) ||\n (c >= 0x25f8 && c <= 0x25ff) ||\n (c >= 0x2600 && c <= 0x266e) ||\n c === 0x266f ||\n (c >= 0x2670 && c <= 0x2767) ||\n c === 0x2768 ||\n c === 0x2769 ||\n c === 0x276a ||\n c === 0x276b ||\n c === 0x276c ||\n c === 0x276d ||\n c === 0x276e ||\n c === 0x276f ||\n c === 0x2770 ||\n c === 0x2771 ||\n c === 0x2772 ||\n c === 0x2773 ||\n c === 0x2774 ||\n c === 0x2775 ||\n (c >= 0x2794 && c <= 0x27bf) ||\n (c >= 0x27c0 && c <= 0x27c4) ||\n c === 0x27c5 ||\n c === 0x27c6 ||\n (c >= 0x27c7 && c <= 0x27e5) ||\n c === 0x27e6 ||\n c === 0x27e7 ||\n c === 0x27e8 ||\n c === 0x27e9 ||\n c === 0x27ea ||\n c === 0x27eb ||\n c === 0x27ec ||\n c === 0x27ed ||\n c === 0x27ee ||\n c === 0x27ef ||\n (c >= 0x27f0 && c <= 0x27ff) ||\n (c >= 0x2800 && c <= 0x28ff) ||\n (c >= 0x2900 && c <= 0x2982) ||\n c === 0x2983 ||\n c === 0x2984 ||\n c === 0x2985 ||\n c === 0x2986 ||\n c === 0x2987 ||\n c === 0x2988 ||\n c === 0x2989 ||\n c === 0x298a ||\n c === 0x298b ||\n c === 0x298c ||\n c === 0x298d ||\n c === 0x298e ||\n c === 0x298f ||\n c === 0x2990 ||\n c === 0x2991 ||\n c === 0x2992 ||\n c === 0x2993 ||\n c === 0x2994 ||\n c === 0x2995 ||\n c === 0x2996 ||\n c === 0x2997 ||\n c === 0x2998 ||\n (c >= 0x2999 && c <= 0x29d7) ||\n c === 0x29d8 ||\n c === 0x29d9 ||\n c === 0x29da ||\n c === 0x29db ||\n (c >= 0x29dc && c <= 0x29fb) ||\n c === 0x29fc ||\n c === 0x29fd ||\n (c >= 0x29fe && c <= 0x2aff) ||\n (c >= 0x2b00 && c <= 0x2b2f) ||\n (c >= 0x2b30 && c <= 0x2b44) ||\n (c >= 0x2b45 && c <= 0x2b46) ||\n (c >= 0x2b47 && c <= 0x2b4c) ||\n (c >= 0x2b4d && c <= 0x2b73) ||\n (c >= 0x2b74 && c <= 0x2b75) ||\n (c >= 0x2b76 && c <= 0x2b95) ||\n c === 0x2b96 ||\n (c >= 0x2b97 && c <= 0x2bff) ||\n (c >= 0x2e00 && c <= 0x2e01) ||\n c === 0x2e02 ||\n c === 0x2e03 ||\n c === 0x2e04 ||\n c === 0x2e05 ||\n (c >= 0x2e06 && c <= 0x2e08) ||\n c === 0x2e09 ||\n c === 0x2e0a ||\n c === 0x2e0b ||\n c === 0x2e0c ||\n c === 0x2e0d ||\n (c >= 0x2e0e && c <= 0x2e16) ||\n c === 0x2e17 ||\n (c >= 0x2e18 && c <= 0x2e19) ||\n c === 0x2e1a ||\n c === 0x2e1b ||\n c === 0x2e1c ||\n c === 0x2e1d ||\n (c >= 0x2e1e && c <= 0x2e1f) ||\n c === 0x2e20 ||\n c === 0x2e21 ||\n c === 0x2e22 ||\n c === 0x2e23 ||\n c === 0x2e24 ||\n c === 0x2e25 ||\n c === 0x2e26 ||\n c === 0x2e27 ||\n c === 0x2e28 ||\n c === 0x2e29 ||\n (c >= 0x2e2a && c <= 0x2e2e) ||\n c === 0x2e2f ||\n (c >= 0x2e30 && c <= 0x2e39) ||\n (c >= 0x2e3a && c <= 0x2e3b) ||\n (c >= 0x2e3c && c <= 0x2e3f) ||\n c === 0x2e40 ||\n c === 0x2e41 ||\n c === 0x2e42 ||\n (c >= 0x2e43 && c <= 0x2e4f) ||\n (c >= 0x2e50 && c <= 0x2e51) ||\n c === 0x2e52 ||\n (c >= 0x2e53 && c <= 0x2e7f) ||\n (c >= 0x3001 && c <= 0x3003) ||\n c === 0x3008 ||\n c === 0x3009 ||\n c === 0x300a ||\n c === 0x300b ||\n c === 0x300c ||\n c === 0x300d ||\n c === 0x300e ||\n c === 0x300f ||\n c === 0x3010 ||\n c === 0x3011 ||\n (c >= 0x3012 && c <= 0x3013) ||\n c === 0x3014 ||\n c === 0x3015 ||\n c === 0x3016 ||\n c === 0x3017 ||\n c === 0x3018 ||\n c === 0x3019 ||\n c === 0x301a ||\n c === 0x301b ||\n c === 0x301c ||\n c === 0x301d ||\n (c >= 0x301e && c <= 0x301f) ||\n c === 0x3020 ||\n c === 0x3030 ||\n c === 0xfd3e ||\n c === 0xfd3f ||\n (c >= 0xfe45 && c <= 0xfe46));\n}\n","import { __assign } from \"tslib\";\nimport { ErrorKind } from './error';\nimport { Parser } from './parser';\nimport { isDateElement, isDateTimeSkeleton, isNumberElement, isNumberSkeleton, isPluralElement, isSelectElement, isTagElement, isTimeElement, } from './types';\nfunction pruneLocation(els) {\n els.forEach(function (el) {\n delete el.location;\n if (isSelectElement(el) || isPluralElement(el)) {\n for (var k in el.options) {\n delete el.options[k].location;\n pruneLocation(el.options[k].value);\n }\n }\n else if (isNumberElement(el) && isNumberSkeleton(el.style)) {\n delete el.style.location;\n }\n else if ((isDateElement(el) || isTimeElement(el)) &&\n isDateTimeSkeleton(el.style)) {\n delete el.style.location;\n }\n else if (isTagElement(el)) {\n pruneLocation(el.children);\n }\n });\n}\nexport function parse(message, opts) {\n if (opts === void 0) { opts = {}; }\n opts = __assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts);\n var result = new Parser(message, opts).parse();\n if (result.err) {\n var error = SyntaxError(ErrorKind[result.err.kind]);\n // @ts-expect-error Assign to error object\n error.location = result.err.location;\n // @ts-expect-error Assign to error object\n error.originalMessage = result.err.message;\n throw error;\n }\n if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) {\n pruneLocation(result.val);\n }\n return result.val;\n}\nexport * from './types';\n// only for testing\nexport var _Parser = Parser;\n","//\n// Main\n//\nexport function memoize(fn, options) {\n var cache = options && options.cache ? options.cache : cacheDefault;\n var serializer = options && options.serializer ? options.serializer : serializerDefault;\n var strategy = options && options.strategy ? options.strategy : strategyDefault;\n return strategy(fn, {\n cache: cache,\n serializer: serializer,\n });\n}\n//\n// Strategy\n//\nfunction isPrimitive(value) {\n return (value == null || typeof value === 'number' || typeof value === 'boolean'); // || typeof value === \"string\" 'unsafe' primitive for our needs\n}\nfunction monadic(fn, cache, serializer, arg) {\n var cacheKey = isPrimitive(arg) ? arg : serializer(arg);\n var computedValue = cache.get(cacheKey);\n if (typeof computedValue === 'undefined') {\n computedValue = fn.call(this, arg);\n cache.set(cacheKey, computedValue);\n }\n return computedValue;\n}\nfunction variadic(fn, cache, serializer) {\n var args = Array.prototype.slice.call(arguments, 3);\n var cacheKey = serializer(args);\n var computedValue = cache.get(cacheKey);\n if (typeof computedValue === 'undefined') {\n computedValue = fn.apply(this, args);\n cache.set(cacheKey, computedValue);\n }\n return computedValue;\n}\nfunction assemble(fn, context, strategy, cache, serialize) {\n return strategy.bind(context, fn, cache, serialize);\n}\nfunction strategyDefault(fn, options) {\n var strategy = fn.length === 1 ? monadic : variadic;\n return assemble(fn, this, strategy, options.cache.create(), options.serializer);\n}\nfunction strategyVariadic(fn, options) {\n return assemble(fn, this, variadic, options.cache.create(), options.serializer);\n}\nfunction strategyMonadic(fn, options) {\n return assemble(fn, this, monadic, options.cache.create(), options.serializer);\n}\n//\n// Serializer\n//\nvar serializerDefault = function () {\n return JSON.stringify(arguments);\n};\n//\n// Cache\n//\nfunction ObjectWithoutPrototypeCache() {\n this.cache = Object.create(null);\n}\nObjectWithoutPrototypeCache.prototype.get = function (key) {\n return this.cache[key];\n};\nObjectWithoutPrototypeCache.prototype.set = function (key, value) {\n this.cache[key] = value;\n};\nvar cacheDefault = {\n create: function create() {\n // @ts-ignore\n return new ObjectWithoutPrototypeCache();\n },\n};\nexport var strategies = {\n variadic: strategyVariadic,\n monadic: strategyMonadic,\n};\n","import { __extends } from \"tslib\";\nexport var ErrorCode;\n(function (ErrorCode) {\n // When we have a placeholder but no value to format\n ErrorCode[\"MISSING_VALUE\"] = \"MISSING_VALUE\";\n // When value supplied is invalid\n ErrorCode[\"INVALID_VALUE\"] = \"INVALID_VALUE\";\n // When we need specific Intl API but it's not available\n ErrorCode[\"MISSING_INTL_API\"] = \"MISSING_INTL_API\";\n})(ErrorCode || (ErrorCode = {}));\nvar FormatError = /** @class */ (function (_super) {\n __extends(FormatError, _super);\n function FormatError(msg, code, originalMessage) {\n var _this = _super.call(this, msg) || this;\n _this.code = code;\n _this.originalMessage = originalMessage;\n return _this;\n }\n FormatError.prototype.toString = function () {\n return \"[formatjs Error: \".concat(this.code, \"] \").concat(this.message);\n };\n return FormatError;\n}(Error));\nexport { FormatError };\nvar InvalidValueError = /** @class */ (function (_super) {\n __extends(InvalidValueError, _super);\n function InvalidValueError(variableId, value, options, originalMessage) {\n return _super.call(this, \"Invalid values for \\\"\".concat(variableId, \"\\\": \\\"\").concat(value, \"\\\". Options are \\\"\").concat(Object.keys(options).join('\", \"'), \"\\\"\"), ErrorCode.INVALID_VALUE, originalMessage) || this;\n }\n return InvalidValueError;\n}(FormatError));\nexport { InvalidValueError };\nvar InvalidValueTypeError = /** @class */ (function (_super) {\n __extends(InvalidValueTypeError, _super);\n function InvalidValueTypeError(value, type, originalMessage) {\n return _super.call(this, \"Value for \\\"\".concat(value, \"\\\" must be of type \").concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;\n }\n return InvalidValueTypeError;\n}(FormatError));\nexport { InvalidValueTypeError };\nvar MissingValueError = /** @class */ (function (_super) {\n __extends(MissingValueError, _super);\n function MissingValueError(variableId, originalMessage) {\n return _super.call(this, \"The intl string context variable \\\"\".concat(variableId, \"\\\" was not provided to the string \\\"\").concat(originalMessage, \"\\\"\"), ErrorCode.MISSING_VALUE, originalMessage) || this;\n }\n return MissingValueError;\n}(FormatError));\nexport { MissingValueError };\n","import { isArgumentElement, isDateElement, isDateTimeSkeleton, isLiteralElement, isNumberElement, isNumberSkeleton, isPluralElement, isPoundElement, isSelectElement, isTimeElement, isTagElement, } from '@formatjs/icu-messageformat-parser';\nimport { MissingValueError, InvalidValueError, ErrorCode, FormatError, InvalidValueTypeError, } from './error';\nexport var PART_TYPE;\n(function (PART_TYPE) {\n PART_TYPE[PART_TYPE[\"literal\"] = 0] = \"literal\";\n PART_TYPE[PART_TYPE[\"object\"] = 1] = \"object\";\n})(PART_TYPE || (PART_TYPE = {}));\nfunction mergeLiteral(parts) {\n if (parts.length < 2) {\n return parts;\n }\n return parts.reduce(function (all, part) {\n var lastPart = all[all.length - 1];\n if (!lastPart ||\n lastPart.type !== PART_TYPE.literal ||\n part.type !== PART_TYPE.literal) {\n all.push(part);\n }\n else {\n lastPart.value += part.value;\n }\n return all;\n }, []);\n}\nexport function isFormatXMLElementFn(el) {\n return typeof el === 'function';\n}\n// TODO(skeleton): add skeleton support\nexport function formatToParts(els, locales, formatters, formats, values, currentPluralValue, \n// For debugging\noriginalMessage) {\n // Hot path for straight simple msg translations\n if (els.length === 1 && isLiteralElement(els[0])) {\n return [\n {\n type: PART_TYPE.literal,\n value: els[0].value,\n },\n ];\n }\n var result = [];\n for (var _i = 0, els_1 = els; _i < els_1.length; _i++) {\n var el = els_1[_i];\n // Exit early for string parts.\n if (isLiteralElement(el)) {\n result.push({\n type: PART_TYPE.literal,\n value: el.value,\n });\n continue;\n }\n // TODO: should this part be literal type?\n // Replace `#` in plural rules with the actual numeric value.\n if (isPoundElement(el)) {\n if (typeof currentPluralValue === 'number') {\n result.push({\n type: PART_TYPE.literal,\n value: formatters.getNumberFormat(locales).format(currentPluralValue),\n });\n }\n continue;\n }\n var varName = el.value;\n // Enforce that all required values are provided by the caller.\n if (!(values && varName in values)) {\n throw new MissingValueError(varName, originalMessage);\n }\n var value = values[varName];\n if (isArgumentElement(el)) {\n if (!value || typeof value === 'string' || typeof value === 'number') {\n value =\n typeof value === 'string' || typeof value === 'number'\n ? String(value)\n : '';\n }\n result.push({\n type: typeof value === 'string' ? PART_TYPE.literal : PART_TYPE.object,\n value: value,\n });\n continue;\n }\n // Recursively format plural and select parts' option — which can be a\n // nested pattern structure. The choosing of the option to use is\n // abstracted-by and delegated-to the part helper object.\n if (isDateElement(el)) {\n var style = typeof el.style === 'string'\n ? formats.date[el.style]\n : isDateTimeSkeleton(el.style)\n ? el.style.parsedOptions\n : undefined;\n result.push({\n type: PART_TYPE.literal,\n value: formatters\n .getDateTimeFormat(locales, style)\n .format(value),\n });\n continue;\n }\n if (isTimeElement(el)) {\n var style = typeof el.style === 'string'\n ? formats.time[el.style]\n : isDateTimeSkeleton(el.style)\n ? el.style.parsedOptions\n : formats.time.medium;\n result.push({\n type: PART_TYPE.literal,\n value: formatters\n .getDateTimeFormat(locales, style)\n .format(value),\n });\n continue;\n }\n if (isNumberElement(el)) {\n var style = typeof el.style === 'string'\n ? formats.number[el.style]\n : isNumberSkeleton(el.style)\n ? el.style.parsedOptions\n : undefined;\n if (style && style.scale) {\n value =\n value *\n (style.scale || 1);\n }\n result.push({\n type: PART_TYPE.literal,\n value: formatters\n .getNumberFormat(locales, style)\n .format(value),\n });\n continue;\n }\n if (isTagElement(el)) {\n var children = el.children, value_1 = el.value;\n var formatFn = values[value_1];\n if (!isFormatXMLElementFn(formatFn)) {\n throw new InvalidValueTypeError(value_1, 'function', originalMessage);\n }\n var parts = formatToParts(children, locales, formatters, formats, values, currentPluralValue);\n var chunks = formatFn(parts.map(function (p) { return p.value; }));\n if (!Array.isArray(chunks)) {\n chunks = [chunks];\n }\n result.push.apply(result, chunks.map(function (c) {\n return {\n type: typeof c === 'string' ? PART_TYPE.literal : PART_TYPE.object,\n value: c,\n };\n }));\n }\n if (isSelectElement(el)) {\n var opt = el.options[value] || el.options.other;\n if (!opt) {\n throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);\n }\n result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values));\n continue;\n }\n if (isPluralElement(el)) {\n var opt = el.options[\"=\".concat(value)];\n if (!opt) {\n if (!Intl.PluralRules) {\n throw new FormatError(\"Intl.PluralRules is not available in this environment.\\nTry polyfilling it using \\\"@formatjs/intl-pluralrules\\\"\\n\", ErrorCode.MISSING_INTL_API, originalMessage);\n }\n var rule = formatters\n .getPluralRules(locales, { type: el.pluralType })\n .select(value - (el.offset || 0));\n opt = el.options[rule] || el.options.other;\n }\n if (!opt) {\n throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);\n }\n result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values, value - (el.offset || 0)));\n continue;\n }\n }\n return mergeLiteral(result);\n}\n","/*\nCopyright (c) 2014, Yahoo! Inc. All rights reserved.\nCopyrights licensed under the New BSD License.\nSee the accompanying LICENSE file for terms.\n*/\nimport { __assign, __rest, __spreadArray } from \"tslib\";\nimport { parse, } from '@formatjs/icu-messageformat-parser';\nimport { memoize, strategies } from '@formatjs/fast-memoize';\nimport { formatToParts, PART_TYPE, } from './formatters';\n// -- MessageFormat --------------------------------------------------------\nfunction mergeConfig(c1, c2) {\n if (!c2) {\n return c1;\n }\n return __assign(__assign(__assign({}, (c1 || {})), (c2 || {})), Object.keys(c1).reduce(function (all, k) {\n all[k] = __assign(__assign({}, c1[k]), (c2[k] || {}));\n return all;\n }, {}));\n}\nfunction mergeConfigs(defaultConfig, configs) {\n if (!configs) {\n return defaultConfig;\n }\n return Object.keys(defaultConfig).reduce(function (all, k) {\n all[k] = mergeConfig(defaultConfig[k], configs[k]);\n return all;\n }, __assign({}, defaultConfig));\n}\nfunction createFastMemoizeCache(store) {\n return {\n create: function () {\n return {\n get: function (key) {\n return store[key];\n },\n set: function (key, value) {\n store[key] = value;\n },\n };\n },\n };\n}\nfunction createDefaultFormatters(cache) {\n if (cache === void 0) { cache = {\n number: {},\n dateTime: {},\n pluralRules: {},\n }; }\n return {\n getNumberFormat: memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.number),\n strategy: strategies.variadic,\n }),\n getDateTimeFormat: memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.dateTime),\n strategy: strategies.variadic,\n }),\n getPluralRules: memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.pluralRules),\n strategy: strategies.variadic,\n }),\n };\n}\nexport var IntlMessageFormat = /** @class */ (function () {\n function IntlMessageFormat(message, locales, overrideFormats, opts) {\n if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; }\n var _this = this;\n this.formatterCache = {\n number: {},\n dateTime: {},\n pluralRules: {},\n };\n this.format = function (values) {\n var parts = _this.formatToParts(values);\n // Hot path for straight simple msg translations\n if (parts.length === 1) {\n return parts[0].value;\n }\n var result = parts.reduce(function (all, part) {\n if (!all.length ||\n part.type !== PART_TYPE.literal ||\n typeof all[all.length - 1] !== 'string') {\n all.push(part.value);\n }\n else {\n all[all.length - 1] += part.value;\n }\n return all;\n }, []);\n if (result.length <= 1) {\n return result[0] || '';\n }\n return result;\n };\n this.formatToParts = function (values) {\n return formatToParts(_this.ast, _this.locales, _this.formatters, _this.formats, values, undefined, _this.message);\n };\n this.resolvedOptions = function () {\n var _a;\n return ({\n locale: ((_a = _this.resolvedLocale) === null || _a === void 0 ? void 0 : _a.toString()) ||\n Intl.NumberFormat.supportedLocalesOf(_this.locales)[0],\n });\n };\n this.getAst = function () { return _this.ast; };\n // Defined first because it's used to build the format pattern.\n this.locales = locales;\n this.resolvedLocale = IntlMessageFormat.resolveLocale(locales);\n if (typeof message === 'string') {\n this.message = message;\n if (!IntlMessageFormat.__parse) {\n throw new TypeError('IntlMessageFormat.__parse must be set to process `message` of type `string`');\n }\n var _a = opts || {}, formatters = _a.formatters, parseOpts = __rest(_a, [\"formatters\"]);\n // Parse string messages into an AST.\n this.ast = IntlMessageFormat.__parse(message, __assign(__assign({}, parseOpts), { locale: this.resolvedLocale }));\n }\n else {\n this.ast = message;\n }\n if (!Array.isArray(this.ast)) {\n throw new TypeError('A message must be provided as a String or AST.');\n }\n // Creates a new object with the specified `formats` merged with the default\n // formats.\n this.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);\n this.formatters =\n (opts && opts.formatters) || createDefaultFormatters(this.formatterCache);\n }\n Object.defineProperty(IntlMessageFormat, \"defaultLocale\", {\n get: function () {\n if (!IntlMessageFormat.memoizedDefaultLocale) {\n IntlMessageFormat.memoizedDefaultLocale =\n new Intl.NumberFormat().resolvedOptions().locale;\n }\n return IntlMessageFormat.memoizedDefaultLocale;\n },\n enumerable: false,\n configurable: true\n });\n IntlMessageFormat.memoizedDefaultLocale = null;\n IntlMessageFormat.resolveLocale = function (locales) {\n if (typeof Intl.Locale === 'undefined') {\n return;\n }\n var supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);\n if (supportedLocales.length > 0) {\n return new Intl.Locale(supportedLocales[0]);\n }\n return new Intl.Locale(typeof locales === 'string' ? locales : locales[0]);\n };\n IntlMessageFormat.__parse = parse;\n // Default format options used as the prototype of the `formats` provided to the\n // constructor. These are used when constructing the internal Intl.NumberFormat\n // and Intl.DateTimeFormat instances.\n IntlMessageFormat.formats = {\n number: {\n integer: {\n maximumFractionDigits: 0,\n },\n currency: {\n style: 'currency',\n },\n percent: {\n style: 'percent',\n },\n },\n date: {\n short: {\n month: 'numeric',\n day: 'numeric',\n year: '2-digit',\n },\n medium: {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n },\n long: {\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n },\n full: {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n },\n },\n time: {\n short: {\n hour: 'numeric',\n minute: 'numeric',\n },\n medium: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n long: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short',\n },\n full: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short',\n },\n },\n };\n return IntlMessageFormat;\n}());\n","import { __extends } from \"tslib\";\nexport var IntlErrorCode;\n(function (IntlErrorCode) {\n IntlErrorCode[\"FORMAT_ERROR\"] = \"FORMAT_ERROR\";\n IntlErrorCode[\"UNSUPPORTED_FORMATTER\"] = \"UNSUPPORTED_FORMATTER\";\n IntlErrorCode[\"INVALID_CONFIG\"] = \"INVALID_CONFIG\";\n IntlErrorCode[\"MISSING_DATA\"] = \"MISSING_DATA\";\n IntlErrorCode[\"MISSING_TRANSLATION\"] = \"MISSING_TRANSLATION\";\n})(IntlErrorCode || (IntlErrorCode = {}));\nvar IntlError = /** @class */ (function (_super) {\n __extends(IntlError, _super);\n function IntlError(code, message, exception) {\n var _this = this;\n var err = exception\n ? exception instanceof Error\n ? exception\n : new Error(String(exception))\n : undefined;\n _this = _super.call(this, \"[@formatjs/intl Error \".concat(code, \"] \").concat(message, \"\\n\").concat(err ? \"\\n\".concat(err.message, \"\\n\").concat(err.stack) : '')) || this;\n _this.code = code;\n // @ts-ignore just so we don't need to declare dep on @types/node\n if (typeof Error.captureStackTrace === 'function') {\n // @ts-ignore just so we don't need to declare dep on @types/node\n Error.captureStackTrace(_this, IntlError);\n }\n return _this;\n }\n return IntlError;\n}(Error));\nexport { IntlError };\nvar UnsupportedFormatterError = /** @class */ (function (_super) {\n __extends(UnsupportedFormatterError, _super);\n function UnsupportedFormatterError(message, exception) {\n return _super.call(this, IntlErrorCode.UNSUPPORTED_FORMATTER, message, exception) || this;\n }\n return UnsupportedFormatterError;\n}(IntlError));\nexport { UnsupportedFormatterError };\nvar InvalidConfigError = /** @class */ (function (_super) {\n __extends(InvalidConfigError, _super);\n function InvalidConfigError(message, exception) {\n return _super.call(this, IntlErrorCode.INVALID_CONFIG, message, exception) || this;\n }\n return InvalidConfigError;\n}(IntlError));\nexport { InvalidConfigError };\nvar MissingDataError = /** @class */ (function (_super) {\n __extends(MissingDataError, _super);\n function MissingDataError(message, exception) {\n return _super.call(this, IntlErrorCode.MISSING_DATA, message, exception) || this;\n }\n return MissingDataError;\n}(IntlError));\nexport { MissingDataError };\nvar IntlFormatError = /** @class */ (function (_super) {\n __extends(IntlFormatError, _super);\n function IntlFormatError(message, locale, exception) {\n var _this = _super.call(this, IntlErrorCode.FORMAT_ERROR, \"\".concat(message, \"\\nLocale: \").concat(locale, \"\\n\"), exception) || this;\n _this.locale = locale;\n return _this;\n }\n return IntlFormatError;\n}(IntlError));\nexport { IntlFormatError };\nvar MessageFormatError = /** @class */ (function (_super) {\n __extends(MessageFormatError, _super);\n function MessageFormatError(message, locale, descriptor, exception) {\n var _this = _super.call(this, \"\".concat(message, \"\\nMessageID: \").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.id, \"\\nDefault Message: \").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage, \"\\nDescription: \").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.description, \"\\n\"), locale, exception) || this;\n _this.descriptor = descriptor;\n _this.locale = locale;\n return _this;\n }\n return MessageFormatError;\n}(IntlFormatError));\nexport { MessageFormatError };\nvar MissingTranslationError = /** @class */ (function (_super) {\n __extends(MissingTranslationError, _super);\n function MissingTranslationError(descriptor, locale) {\n var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, \"Missing message: \\\"\".concat(descriptor.id, \"\\\" for locale \\\"\").concat(locale, \"\\\", using \").concat(descriptor.defaultMessage\n ? \"default message (\".concat(typeof descriptor.defaultMessage === 'string'\n ? descriptor.defaultMessage\n : descriptor.defaultMessage\n .map(function (e) { var _a; return (_a = e.value) !== null && _a !== void 0 ? _a : JSON.stringify(e); })\n .join(), \")\")\n : 'id', \" as fallback.\")) || this;\n _this.descriptor = descriptor;\n return _this;\n }\n return MissingTranslationError;\n}(IntlError));\nexport { MissingTranslationError };\n","import { __assign, __spreadArray } from \"tslib\";\nimport { IntlMessageFormat } from 'intl-messageformat';\nimport { memoize, strategies } from '@formatjs/fast-memoize';\nimport { UnsupportedFormatterError } from './error';\nexport function filterProps(props, allowlist, defaults) {\n if (defaults === void 0) { defaults = {}; }\n return allowlist.reduce(function (filtered, name) {\n if (name in props) {\n filtered[name] = props[name];\n }\n else if (name in defaults) {\n filtered[name] = defaults[name];\n }\n return filtered;\n }, {});\n}\nvar defaultErrorHandler = function (error) {\n // @ts-ignore just so we don't need to declare dep on @types/node\n if (process.env.NODE_ENV !== 'production') {\n console.error(error);\n }\n};\nvar defaultWarnHandler = function (warning) {\n // @ts-ignore just so we don't need to declare dep on @types/node\n if (process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n};\nexport var DEFAULT_INTL_CONFIG = {\n formats: {},\n messages: {},\n timeZone: undefined,\n defaultLocale: 'en',\n defaultFormats: {},\n fallbackOnEmptyString: true,\n onError: defaultErrorHandler,\n onWarn: defaultWarnHandler,\n};\nexport function createIntlCache() {\n return {\n dateTime: {},\n number: {},\n message: {},\n relativeTime: {},\n pluralRules: {},\n list: {},\n displayNames: {},\n };\n}\nfunction createFastMemoizeCache(store) {\n return {\n create: function () {\n return {\n get: function (key) {\n return store[key];\n },\n set: function (key, value) {\n store[key] = value;\n },\n };\n },\n };\n}\n/**\n * Create intl formatters and populate cache\n * @param cache explicit cache to prevent leaking memory\n */\nexport function createFormatters(cache) {\n if (cache === void 0) { cache = createIntlCache(); }\n var RelativeTimeFormat = Intl.RelativeTimeFormat;\n var ListFormat = Intl.ListFormat;\n var DisplayNames = Intl.DisplayNames;\n var getDateTimeFormat = memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.dateTime),\n strategy: strategies.variadic,\n });\n var getNumberFormat = memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.number),\n strategy: strategies.variadic,\n });\n var getPluralRules = memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.pluralRules),\n strategy: strategies.variadic,\n });\n return {\n getDateTimeFormat: getDateTimeFormat,\n getNumberFormat: getNumberFormat,\n getMessageFormat: memoize(function (message, locales, overrideFormats, opts) {\n return new IntlMessageFormat(message, locales, overrideFormats, __assign({ formatters: {\n getNumberFormat: getNumberFormat,\n getDateTimeFormat: getDateTimeFormat,\n getPluralRules: getPluralRules,\n } }, (opts || {})));\n }, {\n cache: createFastMemoizeCache(cache.message),\n strategy: strategies.variadic,\n }),\n getRelativeTimeFormat: memoize(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.relativeTime),\n strategy: strategies.variadic,\n }),\n getPluralRules: getPluralRules,\n getListFormat: memoize(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.list),\n strategy: strategies.variadic,\n }),\n getDisplayNames: memoize(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.displayNames),\n strategy: strategies.variadic,\n }),\n };\n}\nexport function getNamedFormat(formats, type, name, onError) {\n var formatType = formats && formats[type];\n var format;\n if (formatType) {\n format = formatType[name];\n }\n if (format) {\n return format;\n }\n onError(new UnsupportedFormatterError(\"No \".concat(type, \" format named: \").concat(name)));\n}\n","import { __assign } from \"tslib\";\nimport { invariant } from '@formatjs/ecma402-abstract';\nimport { IntlMessageFormat, } from 'intl-messageformat';\nimport { MissingTranslationError, MessageFormatError } from './error';\nimport { TYPE } from '@formatjs/icu-messageformat-parser';\nfunction setTimeZoneInOptions(opts, timeZone) {\n return Object.keys(opts).reduce(function (all, k) {\n all[k] = __assign({ timeZone: timeZone }, opts[k]);\n return all;\n }, {});\n}\nfunction deepMergeOptions(opts1, opts2) {\n var keys = Object.keys(__assign(__assign({}, opts1), opts2));\n return keys.reduce(function (all, k) {\n all[k] = __assign(__assign({}, (opts1[k] || {})), (opts2[k] || {}));\n return all;\n }, {});\n}\nfunction deepMergeFormatsAndSetTimeZone(f1, timeZone) {\n if (!timeZone) {\n return f1;\n }\n var mfFormats = IntlMessageFormat.formats;\n return __assign(__assign(__assign({}, mfFormats), f1), { date: deepMergeOptions(setTimeZoneInOptions(mfFormats.date, timeZone), setTimeZoneInOptions(f1.date || {}, timeZone)), time: deepMergeOptions(setTimeZoneInOptions(mfFormats.time, timeZone), setTimeZoneInOptions(f1.time || {}, timeZone)) });\n}\nexport var formatMessage = function (_a, state, messageDescriptor, values, opts) {\n var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, fallbackOnEmptyString = _a.fallbackOnEmptyString, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;\n if (messageDescriptor === void 0) { messageDescriptor = { id: '' }; }\n var msgId = messageDescriptor.id, defaultMessage = messageDescriptor.defaultMessage;\n // `id` is a required field of a Message Descriptor.\n invariant(!!msgId, \"[@formatjs/intl] An `id` must be provided to format a message. You can either:\\n1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.io/docs/tooling/babel-plugin)\\nor [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer) OR\\n2. Configure your `eslint` config to include [eslint-plugin-formatjs](https://formatjs.io/docs/tooling/linter#enforce-id)\\nto autofix this issue\");\n var id = String(msgId);\n var message = \n // In case messages is Object.create(null)\n // e.g import('foo.json') from webpack)\n // See https://github.com/formatjs/formatjs/issues/1914\n messages &&\n Object.prototype.hasOwnProperty.call(messages, id) &&\n messages[id];\n // IMPORTANT: Hot path if `message` is AST with a single literal node\n if (Array.isArray(message) &&\n message.length === 1 &&\n message[0].type === TYPE.literal) {\n return message[0].value;\n }\n // IMPORTANT: Hot path straight lookup for performance\n if (!values &&\n message &&\n typeof message === 'string' &&\n !defaultRichTextElements) {\n return message.replace(/'\\{(.*?)\\}'/gi, \"{$1}\");\n }\n values = __assign(__assign({}, defaultRichTextElements), (values || {}));\n formats = deepMergeFormatsAndSetTimeZone(formats, timeZone);\n defaultFormats = deepMergeFormatsAndSetTimeZone(defaultFormats, timeZone);\n if (!message) {\n if (fallbackOnEmptyString === false && message === '') {\n return message;\n }\n if (!defaultMessage ||\n (locale && locale.toLowerCase() !== defaultLocale.toLowerCase())) {\n // This prevents warnings from littering the console in development\n // when no `messages` are passed into the for the\n // default locale.\n onError(new MissingTranslationError(messageDescriptor, locale));\n }\n if (defaultMessage) {\n try {\n var formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats, opts);\n return formatter.format(values);\n }\n catch (e) {\n onError(new MessageFormatError(\"Error formatting default message for: \\\"\".concat(id, \"\\\", rendering default message verbatim\"), locale, messageDescriptor, e));\n return typeof defaultMessage === 'string' ? defaultMessage : id;\n }\n }\n return id;\n }\n // We have the translated message\n try {\n var formatter = state.getMessageFormat(message, locale, formats, __assign({ formatters: state }, (opts || {})));\n return formatter.format(values);\n }\n catch (e) {\n onError(new MessageFormatError(\"Error formatting message: \\\"\".concat(id, \"\\\", using \").concat(defaultMessage ? 'default message' : 'id', \" as fallback.\"), locale, messageDescriptor, e));\n }\n if (defaultMessage) {\n try {\n var formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats, opts);\n return formatter.format(values);\n }\n catch (e) {\n onError(new MessageFormatError(\"Error formatting the default message for: \\\"\".concat(id, \"\\\", rendering message verbatim\"), locale, messageDescriptor, e));\n }\n }\n if (typeof message === 'string') {\n return message;\n }\n if (typeof defaultMessage === 'string') {\n return defaultMessage;\n }\n return id;\n};\n","import { __assign } from \"tslib\";\nimport { filterProps, getNamedFormat } from './utils';\nimport { IntlFormatError } from './error';\nvar DATE_TIME_FORMAT_OPTIONS = [\n 'formatMatcher',\n 'timeZone',\n 'hour12',\n 'weekday',\n 'era',\n 'year',\n 'month',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'timeZoneName',\n 'hourCycle',\n 'dateStyle',\n 'timeStyle',\n 'calendar',\n // 'dayPeriod',\n 'numberingSystem',\n 'fractionalSecondDigits',\n];\nexport function getFormatter(_a, type, getDateTimeFormat, options) {\n var locale = _a.locale, formats = _a.formats, onError = _a.onError, timeZone = _a.timeZone;\n if (options === void 0) { options = {}; }\n var format = options.format;\n var defaults = __assign(__assign({}, (timeZone && { timeZone: timeZone })), (format && getNamedFormat(formats, type, format, onError)));\n var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults);\n if (type === 'time' &&\n !filteredOptions.hour &&\n !filteredOptions.minute &&\n !filteredOptions.second &&\n !filteredOptions.timeStyle &&\n !filteredOptions.dateStyle) {\n // Add default formatting options if hour, minute, or second isn't defined.\n filteredOptions = __assign(__assign({}, filteredOptions), { hour: 'numeric', minute: 'numeric' });\n }\n return getDateTimeFormat(locale, filteredOptions);\n}\nexport function formatDate(config, getDateTimeFormat) {\n var _a = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n _a[_i - 2] = arguments[_i];\n }\n var value = _a[0], _b = _a[1], options = _b === void 0 ? {} : _b;\n var date = typeof value === 'string' ? new Date(value || 0) : value;\n try {\n return getFormatter(config, 'date', getDateTimeFormat, options).format(date);\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting date.', config.locale, e));\n }\n return String(date);\n}\nexport function formatTime(config, getDateTimeFormat) {\n var _a = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n _a[_i - 2] = arguments[_i];\n }\n var value = _a[0], _b = _a[1], options = _b === void 0 ? {} : _b;\n var date = typeof value === 'string' ? new Date(value || 0) : value;\n try {\n return getFormatter(config, 'time', getDateTimeFormat, options).format(date);\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting time.', config.locale, e));\n }\n return String(date);\n}\nexport function formatDateTimeRange(config, getDateTimeFormat) {\n var _a = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n _a[_i - 2] = arguments[_i];\n }\n var from = _a[0], to = _a[1], _b = _a[2], options = _b === void 0 ? {} : _b;\n var timeZone = config.timeZone, locale = config.locale, onError = config.onError;\n var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, timeZone ? { timeZone: timeZone } : {});\n try {\n return getDateTimeFormat(locale, filteredOptions).formatRange(from, to);\n }\n catch (e) {\n onError(new IntlFormatError('Error formatting date time range.', config.locale, e));\n }\n return String(from);\n}\nexport function formatDateToParts(config, getDateTimeFormat) {\n var _a = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n _a[_i - 2] = arguments[_i];\n }\n var value = _a[0], _b = _a[1], options = _b === void 0 ? {} : _b;\n var date = typeof value === 'string' ? new Date(value || 0) : value;\n try {\n return getFormatter(config, 'date', getDateTimeFormat, options).formatToParts(date); // TODO: remove this when https://github.com/microsoft/TypeScript/pull/50402 is merged\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting date.', config.locale, e));\n }\n return [];\n}\nexport function formatTimeToParts(config, getDateTimeFormat) {\n var _a = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n _a[_i - 2] = arguments[_i];\n }\n var value = _a[0], _b = _a[1], options = _b === void 0 ? {} : _b;\n var date = typeof value === 'string' ? new Date(value || 0) : value;\n try {\n return getFormatter(config, 'time', getDateTimeFormat, options).formatToParts(date); // TODO: remove this when https://github.com/microsoft/TypeScript/pull/50402 is merged\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting time.', config.locale, e));\n }\n return [];\n}\n","import { filterProps } from './utils';\nimport { FormatError, ErrorCode } from 'intl-messageformat';\nimport { IntlFormatError } from './error';\nvar DISPLAY_NAMES_OPTONS = [\n 'style',\n 'type',\n 'fallback',\n 'languageDisplay',\n];\nexport function formatDisplayName(_a, getDisplayNames, value, options) {\n var locale = _a.locale, onError = _a.onError;\n var DisplayNames = Intl.DisplayNames;\n if (!DisplayNames) {\n onError(new FormatError(\"Intl.DisplayNames is not available in this environment.\\nTry polyfilling it using \\\"@formatjs/intl-displaynames\\\"\\n\", ErrorCode.MISSING_INTL_API));\n }\n var filteredOptions = filterProps(options, DISPLAY_NAMES_OPTONS);\n try {\n return getDisplayNames(locale, filteredOptions).of(value);\n }\n catch (e) {\n onError(new IntlFormatError('Error formatting display name.', locale, e));\n }\n}\n","import { __assign } from \"tslib\";\nimport { filterProps } from './utils';\nimport { FormatError, ErrorCode } from 'intl-messageformat';\nimport { IntlFormatError } from './error';\nvar LIST_FORMAT_OPTIONS = [\n 'type',\n 'style',\n];\nvar now = Date.now();\nfunction generateToken(i) {\n return \"\".concat(now, \"_\").concat(i, \"_\").concat(now);\n}\nexport function formatList(opts, getListFormat, values, options) {\n if (options === void 0) { options = {}; }\n var results = formatListToParts(opts, getListFormat, values, options).reduce(function (all, el) {\n var val = el.value;\n if (typeof val !== 'string') {\n all.push(val);\n }\n else if (typeof all[all.length - 1] === 'string') {\n all[all.length - 1] += val;\n }\n else {\n all.push(val);\n }\n return all;\n }, []);\n return results.length === 1 ? results[0] : results.length === 0 ? '' : results;\n}\nexport function formatListToParts(_a, getListFormat, values, options) {\n var locale = _a.locale, onError = _a.onError;\n if (options === void 0) { options = {}; }\n var ListFormat = Intl.ListFormat;\n if (!ListFormat) {\n onError(new FormatError(\"Intl.ListFormat is not available in this environment.\\nTry polyfilling it using \\\"@formatjs/intl-listformat\\\"\\n\", ErrorCode.MISSING_INTL_API));\n }\n var filteredOptions = filterProps(options, LIST_FORMAT_OPTIONS);\n try {\n var richValues_1 = {};\n var serializedValues = values.map(function (v, i) {\n if (typeof v === 'object') {\n var id = generateToken(i);\n richValues_1[id] = v;\n return id;\n }\n return String(v);\n });\n return getListFormat(locale, filteredOptions)\n .formatToParts(serializedValues)\n .map(function (part) {\n return part.type === 'literal'\n ? part\n : __assign(__assign({}, part), { value: richValues_1[part.value] || part.value });\n });\n }\n catch (e) {\n onError(new IntlFormatError('Error formatting list.', locale, e));\n }\n // @ts-ignore\n return values;\n}\n","import { filterProps } from './utils';\nimport { IntlFormatError } from './error';\nimport { ErrorCode, FormatError } from 'intl-messageformat';\nvar PLURAL_FORMAT_OPTIONS = ['type'];\nexport function formatPlural(_a, getPluralRules, value, options) {\n var locale = _a.locale, onError = _a.onError;\n if (options === void 0) { options = {}; }\n if (!Intl.PluralRules) {\n onError(new FormatError(\"Intl.PluralRules is not available in this environment.\\nTry polyfilling it using \\\"@formatjs/intl-pluralrules\\\"\\n\", ErrorCode.MISSING_INTL_API));\n }\n var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS);\n try {\n return getPluralRules(locale, filteredOptions).select(value);\n }\n catch (e) {\n onError(new IntlFormatError('Error formatting plural.', locale, e));\n }\n return 'other';\n}\n","import { getNamedFormat, filterProps } from './utils';\nimport { FormatError, ErrorCode } from 'intl-messageformat';\nimport { IntlFormatError } from './error';\nvar RELATIVE_TIME_FORMAT_OPTIONS = ['numeric', 'style'];\nfunction getFormatter(_a, getRelativeTimeFormat, options) {\n var locale = _a.locale, formats = _a.formats, onError = _a.onError;\n if (options === void 0) { options = {}; }\n var format = options.format;\n var defaults = (!!format && getNamedFormat(formats, 'relative', format, onError)) || {};\n var filteredOptions = filterProps(options, RELATIVE_TIME_FORMAT_OPTIONS, defaults);\n return getRelativeTimeFormat(locale, filteredOptions);\n}\nexport function formatRelativeTime(config, getRelativeTimeFormat, value, unit, options) {\n if (options === void 0) { options = {}; }\n if (!unit) {\n unit = 'second';\n }\n var RelativeTimeFormat = Intl.RelativeTimeFormat;\n if (!RelativeTimeFormat) {\n config.onError(new FormatError(\"Intl.RelativeTimeFormat is not available in this environment.\\nTry polyfilling it using \\\"@formatjs/intl-relativetimeformat\\\"\\n\", ErrorCode.MISSING_INTL_API));\n }\n try {\n return getFormatter(config, getRelativeTimeFormat, options).format(value, unit);\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting relative time.', config.locale, e));\n }\n return String(value);\n}\n","import { getNamedFormat, filterProps } from './utils';\nimport { IntlFormatError } from './error';\nvar NUMBER_FORMAT_OPTIONS = [\n 'style',\n 'currency',\n 'currencyDisplay',\n 'unit',\n 'unitDisplay',\n 'useGrouping',\n 'minimumIntegerDigits',\n 'minimumFractionDigits',\n 'maximumFractionDigits',\n 'minimumSignificantDigits',\n 'maximumSignificantDigits',\n // ES2020 NumberFormat\n 'compactDisplay',\n 'currencyDisplay',\n 'currencySign',\n 'notation',\n 'signDisplay',\n 'unit',\n 'unitDisplay',\n 'numberingSystem',\n];\nexport function getFormatter(_a, getNumberFormat, options) {\n var locale = _a.locale, formats = _a.formats, onError = _a.onError;\n if (options === void 0) { options = {}; }\n var format = options.format;\n var defaults = ((format &&\n getNamedFormat(formats, 'number', format, onError)) ||\n {});\n var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults);\n return getNumberFormat(locale, filteredOptions);\n}\nexport function formatNumber(config, getNumberFormat, value, options) {\n if (options === void 0) { options = {}; }\n try {\n return getFormatter(config, getNumberFormat, options).format(value);\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting number.', config.locale, e));\n }\n return String(value);\n}\nexport function formatNumberToParts(config, getNumberFormat, value, options) {\n if (options === void 0) { options = {}; }\n try {\n return getFormatter(config, getNumberFormat, options).formatToParts(value);\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting number.', config.locale, e));\n }\n return [];\n}\n","import { __assign } from \"tslib\";\nimport { createFormatters, DEFAULT_INTL_CONFIG } from './utils';\nimport { InvalidConfigError, MissingDataError } from './error';\nimport { formatNumber, formatNumberToParts } from './number';\nimport { formatRelativeTime } from './relativeTime';\nimport { formatDate, formatDateToParts, formatTime, formatTimeToParts, formatDateTimeRange, } from './dateTime';\nimport { formatPlural } from './plural';\nimport { formatMessage } from './message';\nimport { formatList, formatListToParts } from './list';\nimport { formatDisplayName } from './displayName';\nfunction messagesContainString(messages) {\n var firstMessage = messages ? messages[Object.keys(messages)[0]] : undefined;\n return typeof firstMessage === 'string';\n}\nfunction verifyConfigMessages(config) {\n if (config.onWarn &&\n config.defaultRichTextElements &&\n messagesContainString(config.messages || {})) {\n config.onWarn(\"[@formatjs/intl] \\\"defaultRichTextElements\\\" was specified but \\\"message\\\" was not pre-compiled. \\nPlease consider using \\\"@formatjs/cli\\\" to pre-compile your messages for performance.\\nFor more details see https://formatjs.io/docs/getting-started/message-distribution\");\n }\n}\n/**\n * Create intl object\n * @param config intl config\n * @param cache cache for formatter instances to prevent memory leak\n */\nexport function createIntl(config, cache) {\n var formatters = createFormatters(cache);\n var resolvedConfig = __assign(__assign({}, DEFAULT_INTL_CONFIG), config);\n var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;\n if (!locale) {\n if (onError) {\n onError(new InvalidConfigError(\"\\\"locale\\\" was not configured, using \\\"\".concat(defaultLocale, \"\\\" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details\")));\n }\n // Since there's no registered locale data for `locale`, this will\n // fallback to the `defaultLocale` to make sure things can render.\n // The `messages` are overridden to the `defaultProps` empty object\n // to maintain referential equality across re-renders. It's assumed\n // each contains a `defaultMessage` prop.\n resolvedConfig.locale = resolvedConfig.defaultLocale || 'en';\n }\n else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) {\n onError(new MissingDataError(\"Missing locale data for locale: \\\"\".concat(locale, \"\\\" in Intl.NumberFormat. Using default locale: \\\"\").concat(defaultLocale, \"\\\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details\")));\n }\n else if (!Intl.DateTimeFormat.supportedLocalesOf(locale).length &&\n onError) {\n onError(new MissingDataError(\"Missing locale data for locale: \\\"\".concat(locale, \"\\\" in Intl.DateTimeFormat. Using default locale: \\\"\").concat(defaultLocale, \"\\\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details\")));\n }\n verifyConfigMessages(resolvedConfig);\n return __assign(__assign({}, resolvedConfig), { formatters: formatters, formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), \n // @ts-expect-error TODO: will get to this later\n formatMessage: formatMessage.bind(null, resolvedConfig, formatters), \n // @ts-expect-error TODO: will get to this later\n $t: formatMessage.bind(null, resolvedConfig, formatters), formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat), formatListToParts: formatListToParts.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });\n}\n","import { __assign } from \"tslib\";\nimport * as React from 'react';\nimport { invariant } from '@formatjs/ecma402-abstract';\nimport { DEFAULT_INTL_CONFIG as CORE_DEFAULT_INTL_CONFIG } from '@formatjs/intl';\nexport function invariantIntlContext(intl) {\n invariant(intl, '[React Intl] Could not find required `intl` object. ' +\n ' needs to exist in the component ancestry.');\n}\nexport var DEFAULT_INTL_CONFIG = __assign(__assign({}, CORE_DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });\n/**\n * Takes a `formatXMLElementFn`, and composes it in function, which passes\n * argument `parts` through, assigning unique key to each part, to prevent\n * \"Each child in a list should have a unique \"key\"\" React error.\n * @param formatXMLElementFn\n */\nexport function assignUniqueKeysToParts(formatXMLElementFn) {\n return function (parts) {\n // eslint-disable-next-line prefer-rest-params\n return formatXMLElementFn(React.Children.toArray(parts));\n };\n}\nexport function shallowEqual(objA, objB) {\n if (objA === objB) {\n return true;\n }\n if (!objA || !objB) {\n return false;\n }\n var aKeys = Object.keys(objA);\n var bKeys = Object.keys(objB);\n var len = aKeys.length;\n if (bKeys.length !== len) {\n return false;\n }\n for (var i = 0; i < len; i++) {\n var key = aKeys[i];\n if (objA[key] !== objB[key] ||\n !Object.prototype.hasOwnProperty.call(objB, key)) {\n return false;\n }\n }\n return true;\n}\n","import { __assign } from \"tslib\";\nimport * as React from 'react';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport { invariantIntlContext } from '../utils';\nfunction getDisplayName(Component) {\n return Component.displayName || Component.name || 'Component';\n}\n// This is primarily dealing with packaging systems where multiple copies of react-intl\n// might exist\nvar IntlContext = typeof window !== 'undefined'\n ? window.__REACT_INTL_CONTEXT__ ||\n (window.__REACT_INTL_CONTEXT__ = React.createContext(null))\n : React.createContext(null);\nvar IntlConsumer = IntlContext.Consumer, IntlProvider = IntlContext.Provider;\nexport var Provider = IntlProvider;\nexport var Context = IntlContext;\nexport default function injectIntl(WrappedComponent, options) {\n var _a = options || {}, _b = _a.intlPropName, intlPropName = _b === void 0 ? 'intl' : _b, _c = _a.forwardRef, forwardRef = _c === void 0 ? false : _c, _d = _a.enforceContext, enforceContext = _d === void 0 ? true : _d;\n var WithIntl = function (props) { return (React.createElement(IntlConsumer, null, function (intl) {\n var _a;\n if (enforceContext) {\n invariantIntlContext(intl);\n }\n var intlProp = (_a = {}, _a[intlPropName] = intl, _a);\n return (React.createElement(WrappedComponent, __assign({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null })));\n })); };\n WithIntl.displayName = \"injectIntl(\".concat(getDisplayName(WrappedComponent), \")\");\n WithIntl.WrappedComponent = WrappedComponent;\n if (forwardRef) {\n return hoistNonReactStatics(React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, __assign({}, props, { forwardedRef: ref }))); }), WrappedComponent);\n }\n return hoistNonReactStatics(WithIntl, WrappedComponent);\n}\n","import * as React from 'react';\nimport { Context } from './injectIntl';\nimport { invariantIntlContext } from '../utils';\nexport default function useIntl() {\n var intl = React.useContext(Context);\n invariantIntlContext(intl);\n return intl;\n}\n","import { __rest } from \"tslib\";\nimport * as React from 'react';\nimport useIntl from './useIntl';\nvar DisplayName;\n(function (DisplayName) {\n DisplayName[\"formatDate\"] = \"FormattedDate\";\n DisplayName[\"formatTime\"] = \"FormattedTime\";\n DisplayName[\"formatNumber\"] = \"FormattedNumber\";\n DisplayName[\"formatList\"] = \"FormattedList\";\n // Note that this DisplayName is the locale display name, not to be confused with\n // the name of the enum, which is for React component display name in dev tools.\n DisplayName[\"formatDisplayName\"] = \"FormattedDisplayName\";\n})(DisplayName || (DisplayName = {}));\nvar DisplayNameParts;\n(function (DisplayNameParts) {\n DisplayNameParts[\"formatDate\"] = \"FormattedDateParts\";\n DisplayNameParts[\"formatTime\"] = \"FormattedTimeParts\";\n DisplayNameParts[\"formatNumber\"] = \"FormattedNumberParts\";\n DisplayNameParts[\"formatList\"] = \"FormattedListParts\";\n})(DisplayNameParts || (DisplayNameParts = {}));\nexport var FormattedNumberParts = function (props) {\n var intl = useIntl();\n var value = props.value, children = props.children, formatProps = __rest(props, [\"value\", \"children\"]);\n return children(intl.formatNumberToParts(value, formatProps));\n};\nFormattedNumberParts.displayName = 'FormattedNumberParts';\nexport var FormattedListParts = function (props) {\n var intl = useIntl();\n var value = props.value, children = props.children, formatProps = __rest(props, [\"value\", \"children\"]);\n return children(intl.formatListToParts(value, formatProps));\n};\nFormattedNumberParts.displayName = 'FormattedNumberParts';\nexport function createFormattedDateTimePartsComponent(name) {\n var ComponentParts = function (props) {\n var intl = useIntl();\n var value = props.value, children = props.children, formatProps = __rest(props, [\"value\", \"children\"]);\n var date = typeof value === 'string' ? new Date(value || 0) : value;\n var formattedParts = name === 'formatDate'\n ? intl.formatDateToParts(date, formatProps)\n : intl.formatTimeToParts(date, formatProps);\n return children(formattedParts);\n };\n ComponentParts.displayName = DisplayNameParts[name];\n return ComponentParts;\n}\nexport function createFormattedComponent(name) {\n var Component = function (props) {\n var intl = useIntl();\n var value = props.value, children = props.children, formatProps = __rest(props\n // TODO: fix TS type definition for localeMatcher upstream\n , [\"value\", \"children\"]);\n // TODO: fix TS type definition for localeMatcher upstream\n var formattedValue = intl[name](value, formatProps);\n if (typeof children === 'function') {\n return children(formattedValue);\n }\n var Text = intl.textComponent || React.Fragment;\n return React.createElement(Text, null, formattedValue);\n };\n Component.displayName = DisplayName[name];\n return Component;\n}\n","/*\n * Copyright 2015, Yahoo Inc.\n * Copyrights licensed under the New BSD License.\n * See the accompanying LICENSE file for terms.\n */\nimport { __assign, __extends, __rest, __spreadArray } from \"tslib\";\nimport * as React from 'react';\nimport { Provider } from './injectIntl';\nimport { DEFAULT_INTL_CONFIG, invariantIntlContext, assignUniqueKeysToParts, shallowEqual, } from '../utils';\nimport { formatMessage as coreFormatMessage, createIntl as coreCreateIntl, createIntlCache, } from '@formatjs/intl';\nimport { isFormatXMLElementFn, } from 'intl-messageformat';\nfunction processIntlConfig(config) {\n return {\n locale: config.locale,\n timeZone: config.timeZone,\n fallbackOnEmptyString: config.fallbackOnEmptyString,\n formats: config.formats,\n textComponent: config.textComponent,\n messages: config.messages,\n defaultLocale: config.defaultLocale,\n defaultFormats: config.defaultFormats,\n onError: config.onError,\n onWarn: config.onWarn,\n wrapRichTextChunksInFragment: config.wrapRichTextChunksInFragment,\n defaultRichTextElements: config.defaultRichTextElements,\n };\n}\nfunction assignUniqueKeysToFormatXMLElementFnArgument(values) {\n if (!values) {\n return values;\n }\n return Object.keys(values).reduce(function (acc, k) {\n var v = values[k];\n acc[k] = isFormatXMLElementFn(v)\n ? assignUniqueKeysToParts(v)\n : v;\n return acc;\n }, {});\n}\nvar formatMessage = function (config, formatters, descriptor, rawValues) {\n var rest = [];\n for (var _i = 4; _i < arguments.length; _i++) {\n rest[_i - 4] = arguments[_i];\n }\n var values = assignUniqueKeysToFormatXMLElementFnArgument(rawValues);\n var chunks = coreFormatMessage.apply(void 0, __spreadArray([config,\n formatters,\n descriptor,\n values], rest, false));\n if (Array.isArray(chunks)) {\n return React.Children.toArray(chunks);\n }\n return chunks;\n};\n/**\n * Create intl object\n * @param config intl config\n * @param cache cache for formatter instances to prevent memory leak\n */\nexport var createIntl = function (_a, cache) {\n var rawDefaultRichTextElements = _a.defaultRichTextElements, config = __rest(_a, [\"defaultRichTextElements\"]);\n var defaultRichTextElements = assignUniqueKeysToFormatXMLElementFnArgument(rawDefaultRichTextElements);\n var coreIntl = coreCreateIntl(__assign(__assign(__assign({}, DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache);\n var resolvedConfig = {\n locale: coreIntl.locale,\n timeZone: coreIntl.timeZone,\n fallbackOnEmptyString: coreIntl.fallbackOnEmptyString,\n formats: coreIntl.formats,\n defaultLocale: coreIntl.defaultLocale,\n defaultFormats: coreIntl.defaultFormats,\n messages: coreIntl.messages,\n onError: coreIntl.onError,\n defaultRichTextElements: defaultRichTextElements,\n };\n return __assign(__assign({}, coreIntl), { \n // @ts-expect-error fix this\n formatMessage: formatMessage.bind(null, resolvedConfig, coreIntl.formatters), \n // @ts-expect-error fix this\n $t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });\n};\nvar IntlProvider = /** @class */ (function (_super) {\n __extends(IntlProvider, _super);\n function IntlProvider() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.cache = createIntlCache();\n _this.state = {\n cache: _this.cache,\n intl: createIntl(processIntlConfig(_this.props), _this.cache),\n prevConfig: processIntlConfig(_this.props),\n };\n return _this;\n }\n IntlProvider.getDerivedStateFromProps = function (props, _a) {\n var prevConfig = _a.prevConfig, cache = _a.cache;\n var config = processIntlConfig(props);\n if (!shallowEqual(prevConfig, config)) {\n return {\n intl: createIntl(config, cache),\n prevConfig: config,\n };\n }\n return null;\n };\n IntlProvider.prototype.render = function () {\n invariantIntlContext(this.state.intl);\n return React.createElement(Provider, { value: this.state.intl }, this.props.children);\n };\n IntlProvider.displayName = 'IntlProvider';\n IntlProvider.defaultProps = DEFAULT_INTL_CONFIG;\n return IntlProvider;\n}(React.PureComponent));\nexport default IntlProvider;\n","/*\n * Copyright 2015, Yahoo Inc.\n * Copyrights licensed under the New BSD License.\n * See the accompanying LICENSE file for terms.\n */\nimport { __rest } from \"tslib\";\nimport * as React from 'react';\nimport useIntl from './useIntl';\nimport { shallowEqual } from '../utils';\nfunction areEqual(prevProps, nextProps) {\n var values = prevProps.values, otherProps = __rest(prevProps, [\"values\"]);\n var nextValues = nextProps.values, nextOtherProps = __rest(nextProps, [\"values\"]);\n return (shallowEqual(nextValues, values) &&\n shallowEqual(otherProps, nextOtherProps));\n}\nfunction FormattedMessage(props) {\n var intl = useIntl();\n var formatMessage = intl.formatMessage, _a = intl.textComponent, Text = _a === void 0 ? React.Fragment : _a;\n var id = props.id, description = props.description, defaultMessage = props.defaultMessage, values = props.values, children = props.children, _b = props.tagName, Component = _b === void 0 ? Text : _b, ignoreTag = props.ignoreTag;\n var descriptor = { id: id, description: description, defaultMessage: defaultMessage };\n var nodes = formatMessage(descriptor, values, {\n ignoreTag: ignoreTag,\n });\n if (typeof children === 'function') {\n return children(Array.isArray(nodes) ? nodes : [nodes]);\n }\n if (Component) {\n return React.createElement(Component, null, React.Children.toArray(nodes));\n }\n return React.createElement(React.Fragment, null, nodes);\n}\nFormattedMessage.displayName = 'FormattedMessage';\nvar MemoizedFormattedMessage = React.memo(FormattedMessage, areEqual);\nMemoizedFormattedMessage.displayName = 'MemoizedFormattedMessage';\nexport default MemoizedFormattedMessage;\n","import { createFormattedComponent, createFormattedDateTimePartsComponent, } from './src/components/createFormattedComponent';\nimport injectIntl, { Provider as RawIntlProvider, Context as IntlContext, } from './src/components/injectIntl';\nimport useIntl from './src/components/useIntl';\nimport IntlProvider, { createIntl } from './src/components/provider';\nimport FormattedRelativeTime from './src/components/relative';\nimport FormattedPlural from './src/components/plural';\nimport FormattedMessage from './src/components/message';\nimport FormattedDateTimeRange from './src/components/dateTimeRange';\nexport { FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, IntlContext, IntlProvider, RawIntlProvider, createIntl, injectIntl, useIntl, };\nexport { createIntlCache, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode as ReactIntlErrorCode, IntlError as ReactIntlError, } from '@formatjs/intl';\nexport function defineMessages(msgs) {\n return msgs;\n}\nexport function defineMessage(msg) {\n return msg;\n}\n// IMPORTANT: Explicit here to prevent api-extractor from outputing `import('./src/types').CustomFormatConfig`\nexport var FormattedDate = createFormattedComponent('formatDate');\nexport var FormattedTime = createFormattedComponent('formatTime');\nexport var FormattedNumber = createFormattedComponent('formatNumber');\nexport var FormattedList = createFormattedComponent('formatList');\nexport var FormattedDisplayName = createFormattedComponent('formatDisplayName');\nexport var FormattedDateParts = createFormattedDateTimePartsComponent('formatDate');\nexport var FormattedTimeParts = createFormattedDateTimePartsComponent('formatTime');\nexport { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent';\n","import { useIntl } from 'react-intl';\n\nexport function AccountCenter(): JSX.Element {\n const intl = useIntl();\n return (\n \n );\n}\n","import { ChangeEvent, useCallback } from 'react';\n\ninterface SwitcherProps {\n label: string;\n id: string;\n onChange?: (value: boolean) => void;\n checked?: boolean;\n}\n\nexport function Switcher(props: SwitcherProps): JSX.Element {\n const handleChange = useCallback(\n (event: ChangeEvent) => {\n props.onChange?.(event.currentTarget.checked);\n },\n [props.onChange],\n );\n\n return (\n
\n \n \n
\n );\n}\n","export const ApplicationRoutes: Record = {\n home:{\n title: {\n id: 'menu.home'\n },\n body: {\n id: 'home.home-summary'\n },\n navigateTo: {\n pathname: '/',\n state: { shouldResetScroll: true }\n },\n icon: 'groups'\n },\n tradeBlotter:{\n title: {\n id: 'menu.trade-blotter'\n },\n body: {\n id: 'home.trade-blotter-summary'\n },\n navigateTo: {\n pathname: '/trade-blotter/',\n state: { shouldResetScroll: true }\n },\n icon: 'groups'\n },\n stockReconciliation:{\n title: {\n id: 'menu.stock-reconciliation'\n },\n body: {\n id: 'home.stock-reconciliation-summary'\n },\n navigateTo: {\n pathname: '/stock-reconciliation/',\n state: { shouldResetScroll: true }\n },\n icon: 'groups'\n }\n}","/**\n * Copyright (c) 2013-present, Facebook, Inc.\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\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\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\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bigint: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\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\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\tvar nativeCodeString = '[native code]';\n\n\tfunction classNames() {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nimport PropTypes from 'prop-types';\n\n// https://github.com/twbs/bootstrap/blob/v4.0.0-alpha.4/js/src/modal.js#L436-L443\nexport function getScrollbarWidth() {\n var scrollDiv = document.createElement('div');\n // .modal-scrollbar-measure styles // https://github.com/twbs/bootstrap/blob/v4.0.0-alpha.4/scss/_modal.scss#L106-L113\n scrollDiv.style.position = 'absolute';\n scrollDiv.style.top = '-9999px';\n scrollDiv.style.width = '50px';\n scrollDiv.style.height = '50px';\n scrollDiv.style.overflow = 'scroll';\n document.body.appendChild(scrollDiv);\n var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n return scrollbarWidth;\n}\nexport function setScrollbarWidth(padding) {\n document.body.style.paddingRight = padding > 0 ? \"\".concat(padding, \"px\") : null;\n}\nexport function isBodyOverflowing() {\n return document.body.clientWidth < window.innerWidth;\n}\nexport function getOriginalBodyPadding() {\n var style = window.getComputedStyle(document.body, null);\n return parseInt(style && style.getPropertyValue('padding-right') || 0, 10);\n}\nexport function conditionallyUpdateScrollbar() {\n var scrollbarWidth = getScrollbarWidth();\n // https://github.com/twbs/bootstrap/blob/v4.0.0-alpha.6/js/src/modal.js#L433\n var fixedContent = document.querySelectorAll('.fixed-top, .fixed-bottom, .is-fixed, .sticky-top')[0];\n var bodyPadding = fixedContent ? parseInt(fixedContent.style.paddingRight || 0, 10) : 0;\n if (isBodyOverflowing()) {\n setScrollbarWidth(bodyPadding + scrollbarWidth);\n }\n}\nvar globalCssModule;\nexport function setGlobalCssModule(cssModule) {\n globalCssModule = cssModule;\n}\nexport function mapToCssModules() {\n var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var cssModule = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalCssModule;\n if (!cssModule) return className;\n return className.split(' ').map(function (c) {\n return cssModule[c] || c;\n }).join(' ');\n}\n\n/**\n * Returns a new object with the key/value pairs from `obj` that are not in the array `omitKeys`.\n */\nexport function omit(obj, omitKeys) {\n var result = {};\n Object.keys(obj).forEach(function (key) {\n if (omitKeys.indexOf(key) === -1) {\n result[key] = obj[key];\n }\n });\n return result;\n}\n\n/**\n * Returns a filtered copy of an object with only the specified keys.\n */\nexport function pick(obj, keys) {\n var pickKeys = Array.isArray(keys) ? keys : [keys];\n var length = pickKeys.length;\n var key;\n var result = {};\n while (length > 0) {\n length -= 1;\n key = pickKeys[length];\n result[key] = obj[key];\n }\n return result;\n}\nvar warned = {};\nexport function warnOnce(message) {\n if (!warned[message]) {\n /* istanbul ignore else */\n if (typeof console !== 'undefined') {\n console.error(message); // eslint-disable-line no-console\n }\n\n warned[message] = true;\n }\n}\nexport function deprecated(propType, explanation) {\n return function validate(props, propName, componentName) {\n if (props[propName] !== null && typeof props[propName] !== 'undefined') {\n warnOnce(\"\\\"\".concat(propName, \"\\\" property of \\\"\").concat(componentName, \"\\\" has been deprecated.\\n\").concat(explanation));\n }\n for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {\n rest[_key - 3] = arguments[_key];\n }\n return propType.apply(void 0, [props, propName, componentName].concat(rest));\n };\n}\n\n// Shim Element if needed (e.g. in Node environment)\nvar Element = (typeof window === \"undefined\" ? \"undefined\" : _typeof(window)) === 'object' && window.Element || function () {};\nexport function DOMElement(props, propName, componentName) {\n if (!(props[propName] instanceof Element)) {\n return new Error('Invalid prop `' + propName + '` supplied to `' + componentName + '`. Expected prop to be an instance of Element. Validation failed.');\n }\n}\nexport var targetPropType = PropTypes.oneOfType([PropTypes.string, PropTypes.func, DOMElement, PropTypes.shape({\n current: PropTypes.any\n})]);\nexport var tagPropType = PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.shape({\n $$typeof: PropTypes.symbol,\n render: PropTypes.func\n}), PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.shape({\n $$typeof: PropTypes.symbol,\n render: PropTypes.func\n})]))]);\n\n// These are all setup to match what is in the bootstrap _variables.scss\n// https://github.com/twbs/bootstrap/blob/v4-dev/scss/_variables.scss\nexport var TransitionTimeouts = {\n Fade: 150,\n // $transition-fade\n Collapse: 350,\n // $transition-collapse\n Modal: 300,\n // $modal-transition\n Carousel: 600,\n // $carousel-transition\n Offcanvas: 300 // $offcanvas-transition\n};\n\n// Duplicated Transition.propType keys to ensure that Reactstrap builds\n// for distribution properly exclude these keys for nested child HTML attributes\n// since `react-transition-group` removes propTypes in production builds.\nexport var TransitionPropTypeKeys = ['in', 'mountOnEnter', 'unmountOnExit', 'appear', 'enter', 'exit', 'timeout', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'];\nexport var TransitionStatuses = {\n ENTERING: 'entering',\n ENTERED: 'entered',\n EXITING: 'exiting',\n EXITED: 'exited'\n};\nexport var keyCodes = {\n esc: 27,\n space: 32,\n enter: 13,\n tab: 9,\n up: 38,\n down: 40,\n home: 36,\n end: 35,\n n: 78,\n p: 80\n};\nexport var PopperPlacements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];\nexport var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\nexport function isReactRefObj(target) {\n if (target && _typeof(target) === 'object') {\n return 'current' in target;\n }\n return false;\n}\nfunction getTag(value) {\n if (value == null) {\n return value === undefined ? '[object Undefined]' : '[object Null]';\n }\n return Object.prototype.toString.call(value);\n}\nexport function isObject(value) {\n var type = _typeof(value);\n return value != null && (type === 'object' || type === 'function');\n}\nexport function toNumber(value) {\n var type = _typeof(value);\n var NAN = 0 / 0;\n if (type === 'number') {\n return value;\n }\n if (type === 'symbol' || type === 'object' && getTag(value) === '[object Symbol]') {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf === 'function' ? value.valueOf() : value;\n value = isObject(other) ? \"\".concat(other) : other;\n }\n if (type !== 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(/^\\s+|\\s+$/g, '');\n var isBinary = /^0b[01]+$/i.test(value);\n return isBinary || /^0o[0-7]+$/i.test(value) ? parseInt(value.slice(2), isBinary ? 2 : 8) : /^[-+]0x[0-9a-f]+$/i.test(value) ? NAN : +value;\n}\nexport function isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n var tag = getTag(value);\n return tag === '[object Function]' || tag === '[object AsyncFunction]' || tag === '[object GeneratorFunction]' || tag === '[object Proxy]';\n}\nexport function findDOMElements(target) {\n if (isReactRefObj(target)) {\n return target.current;\n }\n if (isFunction(target)) {\n return target();\n }\n if (typeof target === 'string' && canUseDOM) {\n var selection = document.querySelectorAll(target);\n if (!selection.length) {\n selection = document.querySelectorAll(\"#\".concat(target));\n }\n if (!selection.length) {\n throw new Error(\"The target '\".concat(target, \"' could not be identified in the dom, tip: check spelling\"));\n }\n return selection;\n }\n return target;\n}\nexport function isArrayOrNodeList(els) {\n if (els === null) {\n return false;\n }\n return Array.isArray(els) || canUseDOM && typeof els.length === 'number';\n}\nexport function getTarget(target, allElements) {\n var els = findDOMElements(target);\n if (allElements) {\n if (isArrayOrNodeList(els)) {\n return els;\n }\n if (els === null) {\n return [];\n }\n return [els];\n }\n if (isArrayOrNodeList(els)) {\n return els[0];\n }\n return els;\n}\nexport var defaultToggleEvents = ['touchstart', 'click'];\nexport function addMultipleEventListeners(_els, handler, _events, useCapture) {\n var els = _els;\n if (!isArrayOrNodeList(els)) {\n els = [els];\n }\n var events = _events;\n if (typeof events === 'string') {\n events = events.split(/\\s+/);\n }\n if (!isArrayOrNodeList(els) || typeof handler !== 'function' || !Array.isArray(events)) {\n throw new Error(\"\\n The first argument of this function must be DOM node or an array on DOM nodes or NodeList.\\n The second must be a function.\\n The third is a string or an array of strings that represents DOM events\\n \");\n }\n Array.prototype.forEach.call(events, function (event) {\n Array.prototype.forEach.call(els, function (el) {\n el.addEventListener(event, handler, useCapture);\n });\n });\n return function removeEvents() {\n Array.prototype.forEach.call(events, function (event) {\n Array.prototype.forEach.call(els, function (el) {\n el.removeEventListener(event, handler, useCapture);\n });\n });\n };\n}\nexport var focusableElements = ['a[href]', 'area[href]', 'input:not([disabled]):not([type=hidden])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'object', 'embed', '[tabindex]:not(.modal):not(.offcanvas)', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable=\"false\"])'];","var _excluded = [\"expand\", \"className\", \"cssModule\", \"light\", \"dark\", \"fixed\", \"sticky\", \"color\", \"container\", \"tag\", \"children\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { mapToCssModules, tagPropType } from './utils';\nvar propTypes = {\n children: PropTypes.node,\n /** Add custom class */\n className: PropTypes.string,\n /** Theme the navbar by adding a background color */\n color: PropTypes.string,\n /** Use any of the responsive containers to change how wide the content in your navbar is presented. */\n container: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n /** Change underlying component's CSS base class name */\n cssModule: PropTypes.object,\n /** This prop is passed if the background is dark, to make the text lighter */\n dark: PropTypes.bool,\n /** Determine if to show toggler button */\n expand: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n /** Make the navbar fixed at the top */\n fixed: PropTypes.string,\n /** Add `.navbar-light` class */\n light: PropTypes.bool,\n role: PropTypes.string,\n /** Use `position: sticky` which isn't fully supported in every browser */\n sticky: PropTypes.string,\n /** Set a custom element for this component */\n tag: tagPropType\n};\nvar getExpandClass = function getExpandClass(expand) {\n if (expand === false) {\n return false;\n }\n if (expand === true || expand === 'xs') {\n return 'navbar-expand';\n }\n return \"navbar-expand-\".concat(expand);\n};\nfunction Navbar(props) {\n var _classNames;\n var _props$expand = props.expand,\n expand = _props$expand === void 0 ? false : _props$expand,\n className = props.className,\n cssModule = props.cssModule,\n light = props.light,\n dark = props.dark,\n fixed = props.fixed,\n sticky = props.sticky,\n color = props.color,\n _props$container = props.container,\n container = _props$container === void 0 ? 'fluid' : _props$container,\n _props$tag = props.tag,\n Tag = _props$tag === void 0 ? 'nav' : _props$tag,\n children = props.children,\n attributes = _objectWithoutProperties(props, _excluded);\n var classes = mapToCssModules(classNames(className, 'navbar', getExpandClass(expand), (_classNames = {\n 'navbar-light': light,\n 'navbar-dark': dark\n }, _defineProperty(_classNames, \"bg-\".concat(color), color), _defineProperty(_classNames, \"fixed-\".concat(fixed), fixed), _defineProperty(_classNames, \"sticky-\".concat(sticky), sticky), _classNames)), cssModule);\n var containerClass = container && container === true ? 'container' : \"container-\".concat(container);\n return /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, {\n className: classes\n }), container ? /*#__PURE__*/React.createElement(\"div\", {\n className: containerClass\n }, children) : children);\n}\nNavbar.propTypes = propTypes;\nexport default Navbar;","var _excluded = [\"className\", \"cssModule\", \"tag\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { mapToCssModules, tagPropType } from './utils';\nvar propTypes = {\n /** Add custom class */\n className: PropTypes.string,\n /** Change underlying component's CSS base class name */\n cssModule: PropTypes.object,\n /** Set a custom element for this component */\n tag: tagPropType\n};\nfunction NavbarBrand(props) {\n var className = props.className,\n cssModule = props.cssModule,\n _props$tag = props.tag,\n Tag = _props$tag === void 0 ? 'a' : _props$tag,\n attributes = _objectWithoutProperties(props, _excluded);\n var classes = mapToCssModules(classNames(className, 'navbar-brand'), cssModule);\n return /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, {\n className: classes\n }));\n}\nNavbarBrand.propTypes = propTypes;\nexport default NavbarBrand;","var _excluded = [\"className\", \"cssModule\", \"tabs\", \"pills\", \"vertical\", \"horizontal\", \"justified\", \"fill\", \"navbar\", \"card\", \"tag\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { mapToCssModules, tagPropType } from './utils';\nvar propTypes = {\n /** Adding card prop adds `.card-header-tabs` or `.card-header-pills` class */\n card: PropTypes.bool,\n /** Add custom class */\n className: PropTypes.string,\n /** Change underlying component's CSS base class name */\n cssModule: PropTypes.object,\n /** fills the nav to extend to full available width */\n fill: PropTypes.bool,\n /** Change the horizontal alignment of your nav */\n horizontal: PropTypes.oneOf(['center', 'end']),\n /** All horizontal space will be occupied by nav links, but unlike the `fill` above, every nav item will be the same width. */\n justified: PropTypes.bool,\n /** Add navbar for a full-height and lightweight navigation */\n navbar: PropTypes.bool,\n /** Make NavItems look like pills */\n pills: PropTypes.bool,\n /** Make NavItems look like tabs */\n tabs: PropTypes.bool,\n /** Set a custom element for this component */\n tag: tagPropType,\n /** Stack your navigation by changing the flex item direction */\n vertical: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])\n};\nvar getVerticalClass = function getVerticalClass(vertical) {\n if (vertical === false) {\n return false;\n }\n if (vertical === true || vertical === 'xs') {\n return 'flex-column';\n }\n return \"flex-\".concat(vertical, \"-column\");\n};\nfunction Nav(props) {\n var className = props.className,\n cssModule = props.cssModule,\n tabs = props.tabs,\n pills = props.pills,\n _props$vertical = props.vertical,\n vertical = _props$vertical === void 0 ? false : _props$vertical,\n horizontal = props.horizontal,\n justified = props.justified,\n fill = props.fill,\n navbar = props.navbar,\n card = props.card,\n _props$tag = props.tag,\n Tag = _props$tag === void 0 ? 'ul' : _props$tag,\n attributes = _objectWithoutProperties(props, _excluded);\n var classes = mapToCssModules(classNames(className, navbar ? 'navbar-nav' : 'nav', horizontal ? \"justify-content-\".concat(horizontal) : false, getVerticalClass(vertical), {\n 'nav-tabs': tabs,\n 'card-header-tabs': card && tabs,\n 'nav-pills': pills,\n 'card-header-pills': card && pills,\n 'nav-justified': justified,\n 'nav-fill': fill\n }), cssModule);\n return /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, {\n className: classes\n }));\n}\nNav.propTypes = propTypes;\nexport default Nav;","var _excluded = [\"className\", \"cssModule\", \"active\", \"tag\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { mapToCssModules, tagPropType } from './utils';\nvar propTypes = {\n /** Add active class to element */\n active: PropTypes.bool,\n /** Add custom class */\n className: PropTypes.string,\n /** Change underlying component's CSS base class name */\n cssModule: PropTypes.object,\n /** Set a custom element for this component */\n tag: tagPropType\n};\nfunction NavItem(props) {\n var className = props.className,\n cssModule = props.cssModule,\n active = props.active,\n _props$tag = props.tag,\n Tag = _props$tag === void 0 ? 'li' : _props$tag,\n attributes = _objectWithoutProperties(props, _excluded);\n var classes = mapToCssModules(classNames(className, 'nav-item', active ? 'active' : false), cssModule);\n return /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, {\n className: classes\n }));\n}\nNavItem.propTypes = propTypes;\nexport default NavItem;","var _excluded = [\"className\", \"cssModule\", \"variant\", \"innerRef\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { mapToCssModules } from './utils';\nvar propTypes = {\n /** Disable the button if needed */\n active: PropTypes.bool,\n /** Aria label */\n 'aria-label': PropTypes.string,\n /** Function to be triggered on click */\n onClick: PropTypes.func,\n /** Change the variant to white */\n variant: PropTypes.oneOf(['white']),\n className: PropTypes.string,\n cssModule: PropTypes.object,\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])\n};\nfunction CloseButton(props) {\n var className = props.className,\n cssModule = props.cssModule,\n variant = props.variant,\n innerRef = props.innerRef,\n attributes = _objectWithoutProperties(props, _excluded);\n var classes = mapToCssModules(classNames(className, 'btn-close', variant && \"btn-close-\".concat(variant)));\n return /*#__PURE__*/React.createElement(\"button\", _extends({\n ref: innerRef,\n type: \"button\",\n className: classes\n }, _objectSpread({\n 'aria-label': 'close'\n }, attributes)));\n}\nCloseButton.propTypes = propTypes;\nexport default CloseButton;","var _excluded = [\"active\", \"aria-label\", \"block\", \"className\", \"close\", \"cssModule\", \"color\", \"outline\", \"size\", \"tag\", \"innerRef\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport React, { useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { mapToCssModules, tagPropType } from './utils';\nimport CloseButton from './CloseButton';\nvar propTypes = {\n /** Manually set the visual state of the button to active */\n active: PropTypes.bool,\n /** Aria label */\n 'aria-label': PropTypes.string,\n block: PropTypes.bool,\n /** Pass children so this component can wrap them */\n children: PropTypes.node,\n /** Add custom class */\n className: PropTypes.string,\n /** Change existing className with a new className */\n cssModule: PropTypes.object,\n /** Use the button as a close button */\n close: PropTypes.bool,\n /** Change color of Button to one of the available colors */\n color: PropTypes.string,\n /** Disables the button */\n disabled: PropTypes.bool,\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),\n /** Function to be triggered on click */\n onClick: PropTypes.func,\n /** Adds outline to the button */\n outline: PropTypes.bool,\n /** Make the button bigger or smaller */\n size: PropTypes.string,\n /** Set a custom element for this component */\n tag: tagPropType\n};\nfunction Button(props) {\n var onClick = useCallback(function (e) {\n if (props.disabled) {\n e.preventDefault();\n return;\n }\n if (props.onClick) {\n return props.onClick(e);\n }\n }, [props.onClick, props.disabled]);\n var active = props.active,\n ariaLabel = props['aria-label'],\n block = props.block,\n className = props.className,\n close = props.close,\n cssModule = props.cssModule,\n _props$color = props.color,\n color = _props$color === void 0 ? 'secondary' : _props$color,\n outline = props.outline,\n size = props.size,\n _props$tag = props.tag,\n Tag = _props$tag === void 0 ? 'button' : _props$tag,\n innerRef = props.innerRef,\n attributes = _objectWithoutProperties(props, _excluded);\n if (close) {\n return /*#__PURE__*/React.createElement(CloseButton, attributes);\n }\n var btnOutlineColor = \"btn\".concat(outline ? '-outline' : '', \"-\").concat(color);\n var classes = mapToCssModules(classNames(className, 'btn', btnOutlineColor, size ? \"btn-\".concat(size) : false, block ? 'd-block w-100' : false, {\n active: active,\n disabled: props.disabled\n }), cssModule);\n if (attributes.href && Tag === 'button') {\n Tag = 'a';\n }\n return /*#__PURE__*/React.createElement(Tag, _extends({\n type: Tag === 'button' && attributes.onClick ? 'button' : undefined\n }, attributes, {\n className: classes,\n ref: innerRef,\n onClick: onClick,\n \"aria-label\": ariaLabel\n }));\n}\nButton.propTypes = propTypes;\nexport default Button;","import * as React from 'react';\nexport var ManagerReferenceNodeContext = React.createContext();\nexport var ManagerReferenceNodeSetterContext = React.createContext();\nexport function Manager(_ref) {\n var children = _ref.children;\n\n var _React$useState = React.useState(null),\n referenceNode = _React$useState[0],\n setReferenceNode = _React$useState[1];\n\n var hasUnmounted = React.useRef(false);\n React.useEffect(function () {\n return function () {\n hasUnmounted.current = true;\n };\n }, []);\n var handleSetReferenceNode = React.useCallback(function (node) {\n if (!hasUnmounted.current) {\n setReferenceNode(node);\n }\n }, []);\n return /*#__PURE__*/React.createElement(ManagerReferenceNodeContext.Provider, {\n value: referenceNode\n }, /*#__PURE__*/React.createElement(ManagerReferenceNodeSetterContext.Provider, {\n value: handleSetReferenceNode\n }, children));\n}","import * as React from 'react';\n\n/**\n * Takes an argument and if it's an array, returns the first item in the array,\n * otherwise returns the argument. Used for Preact compatibility.\n */\nexport var unwrapArray = function unwrapArray(arg) {\n return Array.isArray(arg) ? arg[0] : arg;\n};\n/**\n * Takes a maybe-undefined function and arbitrary args and invokes the function\n * only if it is defined.\n */\n\nexport var safeInvoke = function safeInvoke(fn) {\n if (typeof fn === 'function') {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return fn.apply(void 0, args);\n }\n};\n/**\n * Sets a ref using either a ref callback or a ref object\n */\n\nexport var setRef = function setRef(ref, node) {\n // if its a function call it\n if (typeof ref === 'function') {\n return safeInvoke(ref, node);\n } // otherwise we should treat it as a ref object\n else if (ref != null) {\n ref.current = node;\n }\n};\n/**\n * Simple ponyfill for Object.fromEntries\n */\n\nexport var fromEntries = function fromEntries(entries) {\n return entries.reduce(function (acc, _ref) {\n var key = _ref[0],\n value = _ref[1];\n acc[key] = value;\n return acc;\n }, {});\n};\n/**\n * Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs\n */\n\nexport var useIsomorphicLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? React.useLayoutEffect : React.useEffect;","export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];","export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}","export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}","import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };","import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};","import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}","export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;","export default function getUAString() {\n var uaData = navigator.userAgentData;\n\n if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {\n return uaData.brands.map(function (item) {\n return item.brand + \"/\" + item.version;\n }).join(' ');\n }\n\n return navigator.userAgent;\n}","import getUAString from \"../utils/userAgent.js\";\nexport default function isLayoutViewport() {\n return !/^((?!chrome|android).)*safari/i.test(getUAString());\n}","import { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nimport getWindow from \"./getWindow.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getBoundingClientRect(element, includeScale, isFixedStrategy) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n\n var clientRect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n var _ref = isElement(element) ? getWindow(element) : window,\n visualViewport = _ref.visualViewport;\n\n var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;\n var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;\n var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;\n var width = clientRect.width / scaleX;\n var height = clientRect.height / scaleY;\n return {\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x,\n x: x,\n y: y\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}","import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}","import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}","import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}","import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}","import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}","import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement, isShadowRoot } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getUAString from \"../utils/userAgent.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = /firefox/i.test(getUAString());\n var isIE = /Trident/i.test(getUAString());\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n if (isShadowRoot(currentNode)) {\n currentNode = currentNode.host;\n }\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}","export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}","import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}","export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}","import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}","export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};","export default function getVariation(placement) {\n return placement.split('-')[1];\n}","import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref, win) {\n var x = _ref.x,\n y = _ref.y;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }, getWindow(popper)) : {\n x: x,\n y: y\n };\n\n x = _ref4.x;\n y = _ref4.y;\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};","import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};","var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}","var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}","import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}","import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getViewportRect(element, strategy) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n var layoutViewport = isLayoutViewport();\n\n if (layoutViewport || !layoutViewport && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}","import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}","import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}","import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}","import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}","export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}","import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element, strategy) {\n var rect = getBoundingClientRect(element, false, strategy === 'fixed');\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent, strategy) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary, strategy) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent, strategy));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}","import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}","import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$strategy = _options.strategy,\n strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}","import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}","import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};","import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};","import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};","export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}","import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis) {\n var _offsetModifierState$;\n\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _offsetModifierState$2;\n\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _len = altAxis === 'y' ? 'height' : 'width';\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};","export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}","import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}","import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}","export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}","export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}","import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n });\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref) {\n var name = _ref.name,\n _ref$options = _ref.options,\n options = _ref$options === void 0 ? {} : _ref$options,\n effect = _ref.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";","/* global Map:readonly, Set:readonly, ArrayBuffer:readonly */\n\nvar hasElementType = typeof Element !== 'undefined';\nvar hasMap = typeof Map === 'function';\nvar hasSet = typeof Set === 'function';\nvar hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView;\n\n// Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js\n\nfunction equal(a, b) {\n // START: fast-deep-equal es6/index.js 3.1.3\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n // START: Modifications:\n // 1. Extra `has &&` helpers in initial condition allow es6 code\n // to co-exist with es5.\n // 2. Replace `for of` with es5 compliant iteration using `for`.\n // Basically, take:\n //\n // ```js\n // for (i of a.entries())\n // if (!b.has(i[0])) return false;\n // ```\n //\n // ... and convert to:\n //\n // ```js\n // it = a.entries();\n // while (!(i = it.next()).done)\n // if (!b.has(i.value[0])) return false;\n // ```\n //\n // **Note**: `i` access switches to `i.value`.\n var it;\n if (hasMap && (a instanceof Map) && (b instanceof Map)) {\n if (a.size !== b.size) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!b.has(i.value[0])) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!equal(i.value[1], b.get(i.value[0]))) return false;\n return true;\n }\n\n if (hasSet && (a instanceof Set) && (b instanceof Set)) {\n if (a.size !== b.size) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!b.has(i.value[0])) return false;\n return true;\n }\n // END: Modifications\n\n if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i]) return false;\n return true;\n }\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n // START: Modifications:\n // Apply guards for `Object.create(null)` handling. See:\n // - https://github.com/FormidableLabs/react-fast-compare/issues/64\n // - https://github.com/epoberezkin/fast-deep-equal/issues/49\n if (a.valueOf !== Object.prototype.valueOf && typeof a.valueOf === 'function' && typeof b.valueOf === 'function') return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString && typeof a.toString === 'function' && typeof b.toString === 'function') return a.toString() === b.toString();\n // END: Modifications\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n // END: fast-deep-equal\n\n // START: react-fast-compare\n // custom handling for DOM elements\n if (hasElementType && a instanceof Element) return false;\n\n // custom handling for React/Preact\n for (i = length; i-- !== 0;) {\n if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {\n // React-specific: avoid traversing React elements' _owner\n // Preact-specific: avoid traversing Preact elements' __v and __o\n // __v = $_original / $_vnode\n // __o = $_owner\n // These properties contain circular references and are not needed when\n // comparing the actual elements (and not their owners)\n // .$$typeof and ._store on just reasonable markers of elements\n\n continue;\n }\n\n // all other properties should be traversed as usual\n if (!equal(a[keys[i]], b[keys[i]])) return false;\n }\n // END: react-fast-compare\n\n // START: fast-deep-equal\n return true;\n }\n\n return a !== a && b !== b;\n}\n// end fast-deep-equal\n\nmodule.exports = function isEqual(a, b) {\n try {\n return equal(a, b);\n } catch (error) {\n if (((error.message || '').match(/stack|recursion/i))) {\n // warn on circular references, don't crash\n // browsers give this different errors name and messages:\n // chrome/safari: \"RangeError\", \"Maximum call stack size exceeded\"\n // firefox: \"InternalError\", too much recursion\"\n // edge: \"Error\", \"Out of stack space\"\n console.warn('react-fast-compare cannot handle circular refs');\n return false;\n }\n // some other error. we should definitely know about these\n throw error;\n }\n};\n","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { createPopper as defaultCreatePopper } from '@popperjs/core';\nimport isEqual from 'react-fast-compare';\nimport { fromEntries, useIsomorphicLayoutEffect } from './utils';\nvar EMPTY_MODIFIERS = [];\nexport var usePopper = function usePopper(referenceElement, popperElement, options) {\n if (options === void 0) {\n options = {};\n }\n\n var prevOptions = React.useRef(null);\n var optionsWithDefaults = {\n onFirstUpdate: options.onFirstUpdate,\n placement: options.placement || 'bottom',\n strategy: options.strategy || 'absolute',\n modifiers: options.modifiers || EMPTY_MODIFIERS\n };\n\n var _React$useState = React.useState({\n styles: {\n popper: {\n position: optionsWithDefaults.strategy,\n left: '0',\n top: '0'\n },\n arrow: {\n position: 'absolute'\n }\n },\n attributes: {}\n }),\n state = _React$useState[0],\n setState = _React$useState[1];\n\n var updateStateModifier = React.useMemo(function () {\n return {\n name: 'updateState',\n enabled: true,\n phase: 'write',\n fn: function fn(_ref) {\n var state = _ref.state;\n var elements = Object.keys(state.elements);\n ReactDOM.flushSync(function () {\n setState({\n styles: fromEntries(elements.map(function (element) {\n return [element, state.styles[element] || {}];\n })),\n attributes: fromEntries(elements.map(function (element) {\n return [element, state.attributes[element]];\n }))\n });\n });\n },\n requires: ['computeStyles']\n };\n }, []);\n var popperOptions = React.useMemo(function () {\n var newOptions = {\n onFirstUpdate: optionsWithDefaults.onFirstUpdate,\n placement: optionsWithDefaults.placement,\n strategy: optionsWithDefaults.strategy,\n modifiers: [].concat(optionsWithDefaults.modifiers, [updateStateModifier, {\n name: 'applyStyles',\n enabled: false\n }])\n };\n\n if (isEqual(prevOptions.current, newOptions)) {\n return prevOptions.current || newOptions;\n } else {\n prevOptions.current = newOptions;\n return newOptions;\n }\n }, [optionsWithDefaults.onFirstUpdate, optionsWithDefaults.placement, optionsWithDefaults.strategy, optionsWithDefaults.modifiers, updateStateModifier]);\n var popperInstanceRef = React.useRef();\n useIsomorphicLayoutEffect(function () {\n if (popperInstanceRef.current) {\n popperInstanceRef.current.setOptions(popperOptions);\n }\n }, [popperOptions]);\n useIsomorphicLayoutEffect(function () {\n if (referenceElement == null || popperElement == null) {\n return;\n }\n\n var createPopper = options.createPopper || defaultCreatePopper;\n var popperInstance = createPopper(referenceElement, popperElement, popperOptions);\n popperInstanceRef.current = popperInstance;\n return function () {\n popperInstance.destroy();\n popperInstanceRef.current = null;\n };\n }, [referenceElement, popperElement, options.createPopper]);\n return {\n state: popperInstanceRef.current ? popperInstanceRef.current.state : null,\n styles: state.styles,\n attributes: state.attributes,\n update: popperInstanceRef.current ? popperInstanceRef.current.update : null,\n forceUpdate: popperInstanceRef.current ? popperInstanceRef.current.forceUpdate : null\n };\n};","import * as React from 'react';\nimport { ManagerReferenceNodeContext } from './Manager';\nimport { unwrapArray, setRef } from './utils';\nimport { usePopper } from './usePopper';\n\nvar NOOP = function NOOP() {\n return void 0;\n};\n\nvar NOOP_PROMISE = function NOOP_PROMISE() {\n return Promise.resolve(null);\n};\n\nvar EMPTY_MODIFIERS = [];\nexport function Popper(_ref) {\n var _ref$placement = _ref.placement,\n placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,\n _ref$strategy = _ref.strategy,\n strategy = _ref$strategy === void 0 ? 'absolute' : _ref$strategy,\n _ref$modifiers = _ref.modifiers,\n modifiers = _ref$modifiers === void 0 ? EMPTY_MODIFIERS : _ref$modifiers,\n referenceElement = _ref.referenceElement,\n onFirstUpdate = _ref.onFirstUpdate,\n innerRef = _ref.innerRef,\n children = _ref.children;\n var referenceNode = React.useContext(ManagerReferenceNodeContext);\n\n var _React$useState = React.useState(null),\n popperElement = _React$useState[0],\n setPopperElement = _React$useState[1];\n\n var _React$useState2 = React.useState(null),\n arrowElement = _React$useState2[0],\n setArrowElement = _React$useState2[1];\n\n React.useEffect(function () {\n setRef(innerRef, popperElement);\n }, [innerRef, popperElement]);\n var options = React.useMemo(function () {\n return {\n placement: placement,\n strategy: strategy,\n onFirstUpdate: onFirstUpdate,\n modifiers: [].concat(modifiers, [{\n name: 'arrow',\n enabled: arrowElement != null,\n options: {\n element: arrowElement\n }\n }])\n };\n }, [placement, strategy, onFirstUpdate, modifiers, arrowElement]);\n\n var _usePopper = usePopper(referenceElement || referenceNode, popperElement, options),\n state = _usePopper.state,\n styles = _usePopper.styles,\n forceUpdate = _usePopper.forceUpdate,\n update = _usePopper.update;\n\n var childrenProps = React.useMemo(function () {\n return {\n ref: setPopperElement,\n style: styles.popper,\n placement: state ? state.placement : placement,\n hasPopperEscaped: state && state.modifiersData.hide ? state.modifiersData.hide.hasPopperEscaped : null,\n isReferenceHidden: state && state.modifiersData.hide ? state.modifiersData.hide.isReferenceHidden : null,\n arrowProps: {\n style: styles.arrow,\n ref: setArrowElement\n },\n forceUpdate: forceUpdate || NOOP,\n update: update || NOOP_PROMISE\n };\n }, [setPopperElement, setArrowElement, placement, state, styles, update, forceUpdate]);\n return unwrapArray(children)(childrenProps);\n}","import * as React from 'react';\nimport warning from 'warning';\nimport { ManagerReferenceNodeSetterContext } from './Manager';\nimport { safeInvoke, unwrapArray, setRef } from './utils';\nexport function Reference(_ref) {\n var children = _ref.children,\n innerRef = _ref.innerRef;\n var setReferenceNode = React.useContext(ManagerReferenceNodeSetterContext);\n var refHandler = React.useCallback(function (node) {\n setRef(innerRef, node);\n safeInvoke(setReferenceNode, node);\n }, [innerRef, setReferenceNode]); // ran on unmount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n\n React.useEffect(function () {\n return function () {\n return setRef(innerRef, null);\n };\n }, []);\n React.useEffect(function () {\n warning(Boolean(setReferenceNode), '`Reference` should not be used outside of a `Manager` component.');\n }, [setReferenceNode]);\n return unwrapArray(children)({\n ref: refHandler\n });\n}","import React from 'react';\n\n/**\n * DropdownContext\n * {\n * toggle: PropTypes.func.isRequired,\n * isOpen: PropTypes.bool.isRequired,\n * direction: PropTypes.oneOf(['up', 'down', 'start', 'end']).isRequired,\n * inNavbar: PropTypes.bool.isRequired,\n * disabled: PropTypes.bool\n * }\n */\nexport var DropdownContext = /*#__PURE__*/React.createContext({});","import React from 'react';\nexport var InputGroupContext = /*#__PURE__*/React.createContext({});","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _excluded = [\"className\", \"cssModule\", \"direction\", \"isOpen\", \"group\", \"size\", \"nav\", \"setActiveFromChild\", \"active\", \"tag\", \"menuRole\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n/* eslint react/no-find-dom-node: 0 */\n// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { Manager } from 'react-popper';\nimport classNames from 'classnames';\nimport { DropdownContext } from './DropdownContext';\nimport { mapToCssModules, omit, keyCodes, tagPropType } from './utils';\nimport { InputGroupContext } from './InputGroupContext';\nvar propTypes = {\n a11y: PropTypes.bool,\n disabled: PropTypes.bool,\n direction: PropTypes.oneOf(['up', 'down', 'start', 'end', 'left', 'right']),\n group: PropTypes.bool,\n isOpen: PropTypes.bool,\n nav: PropTypes.bool,\n active: PropTypes.bool,\n size: PropTypes.string,\n tag: tagPropType,\n toggle: PropTypes.func,\n children: PropTypes.node,\n className: PropTypes.string,\n cssModule: PropTypes.object,\n dropup: PropTypes.bool,\n inNavbar: PropTypes.bool,\n setActiveFromChild: PropTypes.bool,\n menuRole: PropTypes.oneOf(['listbox', 'menu'])\n};\nvar defaultProps = {\n a11y: true,\n isOpen: false,\n direction: 'down',\n nav: false,\n active: false,\n inNavbar: false,\n setActiveFromChild: false\n};\nvar preventDefaultKeys = [keyCodes.space, keyCodes.enter, keyCodes.up, keyCodes.down, keyCodes.end, keyCodes.home];\nvar Dropdown = /*#__PURE__*/function (_React$Component) {\n _inherits(Dropdown, _React$Component);\n var _super = _createSuper(Dropdown);\n function Dropdown(props) {\n var _this;\n _classCallCheck(this, Dropdown);\n _this = _super.call(this, props);\n _this.addEvents = _this.addEvents.bind(_assertThisInitialized(_this));\n _this.handleDocumentClick = _this.handleDocumentClick.bind(_assertThisInitialized(_this));\n _this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));\n _this.removeEvents = _this.removeEvents.bind(_assertThisInitialized(_this));\n _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));\n _this.handleMenuRef = _this.handleMenuRef.bind(_assertThisInitialized(_this));\n _this.handleToggleRef = _this.handleToggleRef.bind(_assertThisInitialized(_this));\n _this.containerRef = /*#__PURE__*/React.createRef();\n _this.menuRef = /*#__PURE__*/React.createRef();\n _this.toggleRef = /*#__PURE__*/React.createRef();\n // ref for DropdownToggle\n return _this;\n }\n _createClass(Dropdown, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.handleProps();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n if (this.props.isOpen !== prevProps.isOpen) {\n this.handleProps();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.removeEvents();\n }\n }, {\n key: \"handleMenuRef\",\n value: function handleMenuRef(menuRef) {\n this.menuRef.current = menuRef;\n }\n }, {\n key: \"handleToggleRef\",\n value: function handleToggleRef(toggleRef) {\n this.toggleRef.current = toggleRef;\n }\n }, {\n key: \"handleDocumentClick\",\n value: function handleDocumentClick(e) {\n if (e && (e.which === 3 || e.type === 'keyup' && e.which !== keyCodes.tab)) return;\n var container = this.getContainer();\n var menu = this.getMenu();\n var toggle = this.getToggle();\n var targetIsToggle = toggle.contains(e.target);\n var clickIsInMenu = menu && menu.contains(e.target) && menu !== e.target;\n var clickIsInInput = false;\n if (container) {\n // this is only for InputGroup with type dropdown\n clickIsInInput = container.classList.contains('input-group') && container.classList.contains('dropdown') && e.target.tagName === 'INPUT';\n }\n if ((targetIsToggle && !clickIsInInput || clickIsInMenu) && (e.type !== 'keyup' || e.which === keyCodes.tab)) {\n return;\n }\n this.toggle(e);\n }\n }, {\n key: \"handleKeyDown\",\n value: function handleKeyDown(e) {\n var _this2 = this;\n var isTargetMenuItem = e.target.getAttribute('role') === 'menuitem' || e.target.getAttribute('role') === 'option';\n var isTargetMenuCtrl = this.getMenuCtrl() === e.target;\n var isTab = keyCodes.tab === e.which;\n if (/input|textarea/i.test(e.target.tagName) || isTab && !this.props.a11y || isTab && !(isTargetMenuItem || isTargetMenuCtrl)) {\n return;\n }\n if (preventDefaultKeys.indexOf(e.which) !== -1 || e.which >= 48 && e.which <= 90) {\n e.preventDefault();\n }\n if (this.props.disabled) return;\n if (isTargetMenuCtrl) {\n if ([keyCodes.space, keyCodes.enter, keyCodes.up, keyCodes.down].indexOf(e.which) > -1) {\n // Open the menu (if not open) and focus the first menu item\n if (!this.props.isOpen) {\n this.toggle(e);\n }\n setTimeout(function () {\n var _this2$getMenuItems$;\n return (_this2$getMenuItems$ = _this2.getMenuItems()[0]) === null || _this2$getMenuItems$ === void 0 ? void 0 : _this2$getMenuItems$.focus();\n });\n } else if (this.props.isOpen && isTab) {\n var _this$getMenuItems$;\n // Focus the first menu item if tabbing from an open menu. We need this\n // for cases where the DropdownMenu sets a custom container, which may\n // not be the natural next item to tab to from the DropdownToggle.\n e.preventDefault();\n (_this$getMenuItems$ = this.getMenuItems()[0]) === null || _this$getMenuItems$ === void 0 ? void 0 : _this$getMenuItems$.focus();\n } else if (this.props.isOpen && e.which === keyCodes.esc) {\n this.toggle(e);\n }\n }\n if (this.props.isOpen && isTargetMenuItem) {\n if ([keyCodes.tab, keyCodes.esc].indexOf(e.which) > -1) {\n this.toggle(e);\n this.getMenuCtrl().focus();\n } else if ([keyCodes.space, keyCodes.enter].indexOf(e.which) > -1) {\n e.target.click();\n this.getMenuCtrl().focus();\n } else if ([keyCodes.down, keyCodes.up].indexOf(e.which) > -1 || [keyCodes.n, keyCodes.p].indexOf(e.which) > -1 && e.ctrlKey) {\n var $menuitems = this.getMenuItems();\n var index = $menuitems.indexOf(e.target);\n if (keyCodes.up === e.which || keyCodes.p === e.which && e.ctrlKey) {\n index = index !== 0 ? index - 1 : $menuitems.length - 1;\n } else if (keyCodes.down === e.which || keyCodes.n === e.which && e.ctrlKey) {\n index = index === $menuitems.length - 1 ? 0 : index + 1;\n }\n $menuitems[index].focus();\n } else if (keyCodes.end === e.which) {\n var _$menuitems = this.getMenuItems();\n _$menuitems[_$menuitems.length - 1].focus();\n } else if (keyCodes.home === e.which) {\n var _$menuitems2 = this.getMenuItems();\n _$menuitems2[0].focus();\n } else if (e.which >= 48 && e.which <= 90) {\n var _$menuitems3 = this.getMenuItems();\n var charPressed = String.fromCharCode(e.which).toLowerCase();\n for (var i = 0; i < _$menuitems3.length; i += 1) {\n var firstLetter = _$menuitems3[i].textContent && _$menuitems3[i].textContent[0].toLowerCase();\n if (firstLetter === charPressed) {\n _$menuitems3[i].focus();\n break;\n }\n }\n }\n }\n }\n }, {\n key: \"handleProps\",\n value: function handleProps() {\n if (this.props.isOpen) {\n this.addEvents();\n } else {\n this.removeEvents();\n }\n }\n }, {\n key: \"getContextValue\",\n value: function getContextValue() {\n return {\n toggle: this.toggle,\n isOpen: this.props.isOpen,\n direction: this.props.direction === 'down' && this.props.dropup ? 'up' : this.props.direction,\n inNavbar: this.props.inNavbar,\n disabled: this.props.disabled,\n // Callback that should be called by DropdownMenu to provide a ref to\n // a HTML tag that's used for the DropdownMenu\n onMenuRef: this.handleMenuRef,\n onToggleRef: this.handleToggleRef,\n menuRole: this.props.menuRole\n };\n }\n }, {\n key: \"getContainer\",\n value: function getContainer() {\n return this.containerRef.current;\n }\n }, {\n key: \"getMenu\",\n value: function getMenu() {\n return this.menuRef.current;\n }\n }, {\n key: \"getToggle\",\n value: function getToggle() {\n return this.toggleRef.current;\n }\n }, {\n key: \"getMenuCtrl\",\n value: function getMenuCtrl() {\n if (this._$menuCtrl) return this._$menuCtrl;\n this._$menuCtrl = this.getToggle();\n return this._$menuCtrl;\n }\n }, {\n key: \"getItemType\",\n value: function getItemType() {\n if (this.props.menuRole === 'listbox') {\n return 'option';\n }\n return 'menuitem';\n }\n }, {\n key: \"getMenuItems\",\n value: function getMenuItems() {\n // In a real menu with a child DropdownMenu, `this.getMenu()` should never\n // be null, but it is sometimes null in tests. To mitigate that, we just\n // use `this.getContainer()` as the fallback `menuContainer`.\n var menuContainer = this.getMenu() || this.getContainer();\n return [].slice.call(menuContainer.querySelectorAll(\"[role=\\\"\".concat(this.getItemType(), \"\\\"]\")));\n }\n }, {\n key: \"addEvents\",\n value: function addEvents() {\n var _this3 = this;\n ['click', 'touchstart', 'keyup'].forEach(function (event) {\n return document.addEventListener(event, _this3.handleDocumentClick, true);\n });\n }\n }, {\n key: \"removeEvents\",\n value: function removeEvents() {\n var _this4 = this;\n ['click', 'touchstart', 'keyup'].forEach(function (event) {\n return document.removeEventListener(event, _this4.handleDocumentClick, true);\n });\n }\n }, {\n key: \"toggle\",\n value: function toggle(e) {\n if (this.props.disabled) {\n return e && e.preventDefault();\n }\n return this.props.toggle(e);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _classNames,\n _this5 = this;\n var _omit = omit(this.props, ['toggle', 'disabled', 'inNavbar', 'a11y']),\n className = _omit.className,\n cssModule = _omit.cssModule,\n direction = _omit.direction,\n isOpen = _omit.isOpen,\n group = _omit.group,\n size = _omit.size,\n nav = _omit.nav,\n setActiveFromChild = _omit.setActiveFromChild,\n active = _omit.active,\n tag = _omit.tag,\n menuRole = _omit.menuRole,\n attrs = _objectWithoutProperties(_omit, _excluded);\n var Tag = tag || (nav ? 'li' : 'div');\n var subItemIsActive = false;\n if (setActiveFromChild) {\n React.Children.map(this.props.children[1].props.children, function (dropdownItem) {\n if (dropdownItem && dropdownItem.props.active) subItemIsActive = true;\n });\n }\n var classes = mapToCssModules(classNames(className, nav && active ? 'active' : false, setActiveFromChild && subItemIsActive ? 'active' : false, (_classNames = {\n 'btn-group': group\n }, _defineProperty(_classNames, \"btn-group-\".concat(size), !!size), _defineProperty(_classNames, \"dropdown\", !group), _defineProperty(_classNames, \"dropup\", direction === 'up'), _defineProperty(_classNames, \"dropstart\", direction === 'start' || direction === 'left'), _defineProperty(_classNames, \"dropend\", direction === 'end' || direction === 'right'), _defineProperty(_classNames, \"show\", isOpen), _defineProperty(_classNames, 'nav-item', nav), _classNames)), cssModule);\n if (this.context.insideInputGroup) {\n return /*#__PURE__*/React.createElement(DropdownContext.Provider, {\n value: this.getContextValue()\n }, /*#__PURE__*/React.createElement(Manager, null, React.Children.map(this.props.children, function (child) {\n return /*#__PURE__*/React.cloneElement(child, {\n onKeyDown: _this5.handleKeyDown\n });\n })));\n }\n return /*#__PURE__*/React.createElement(DropdownContext.Provider, {\n value: this.getContextValue()\n }, /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Tag, _extends({}, attrs, _defineProperty({}, typeof Tag === 'string' ? 'ref' : 'innerRef', this.containerRef), {\n onKeyDown: this.handleKeyDown,\n className: classes\n }))));\n }\n }]);\n return Dropdown;\n}(React.Component);\nDropdown.propTypes = propTypes;\nDropdown.defaultProps = defaultProps;\nDropdown.contextType = InputGroupContext;\nexport default Dropdown;","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _excluded = [\"className\", \"cssModule\", \"divider\", \"tag\", \"header\", \"active\", \"text\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { DropdownContext } from './DropdownContext';\nimport { mapToCssModules, omit, tagPropType } from './utils';\nvar propTypes = {\n children: PropTypes.node,\n active: PropTypes.bool,\n disabled: PropTypes.bool,\n divider: PropTypes.bool,\n tag: tagPropType,\n header: PropTypes.bool,\n onClick: PropTypes.func,\n className: PropTypes.string,\n cssModule: PropTypes.object,\n toggle: PropTypes.bool,\n text: PropTypes.bool\n};\nvar DropdownItem = /*#__PURE__*/function (_React$Component) {\n _inherits(DropdownItem, _React$Component);\n var _super = _createSuper(DropdownItem);\n function DropdownItem(props) {\n var _this;\n _classCallCheck(this, DropdownItem);\n _this = _super.call(this, props);\n _this.onClick = _this.onClick.bind(_assertThisInitialized(_this));\n _this.getTabIndex = _this.getTabIndex.bind(_assertThisInitialized(_this));\n return _this;\n }\n _createClass(DropdownItem, [{\n key: \"onClick\",\n value: function onClick(e) {\n var _this$props$toggle;\n var _this$props = this.props,\n disabled = _this$props.disabled,\n header = _this$props.header,\n divider = _this$props.divider,\n text = _this$props.text;\n if (disabled || header || divider || text) {\n e.preventDefault();\n return;\n }\n if (this.props.onClick) {\n this.props.onClick(e);\n }\n if ((_this$props$toggle = this.props.toggle) !== null && _this$props$toggle !== void 0 ? _this$props$toggle : true) {\n this.context.toggle(e);\n }\n }\n }, {\n key: \"getRole\",\n value: function getRole() {\n if (this.context.menuRole === 'listbox') {\n return 'option';\n }\n return 'menuitem';\n }\n }, {\n key: \"getTabIndex\",\n value: function getTabIndex() {\n var _this$props2 = this.props,\n disabled = _this$props2.disabled,\n header = _this$props2.header,\n divider = _this$props2.divider,\n text = _this$props2.text;\n if (disabled || header || divider || text) {\n return '-1';\n }\n return '0';\n }\n }, {\n key: \"render\",\n value: function render() {\n var tabIndex = this.getTabIndex();\n var role = tabIndex > -1 ? this.getRole() : undefined;\n var _omit = omit(this.props, ['toggle']),\n className = _omit.className,\n cssModule = _omit.cssModule,\n divider = _omit.divider,\n _omit$tag = _omit.tag,\n Tag = _omit$tag === void 0 ? 'button' : _omit$tag,\n header = _omit.header,\n active = _omit.active,\n text = _omit.text,\n props = _objectWithoutProperties(_omit, _excluded);\n var classes = mapToCssModules(classNames(className, {\n disabled: props.disabled,\n 'dropdown-item': !divider && !header && !text,\n active: active,\n 'dropdown-header': header,\n 'dropdown-divider': divider,\n 'dropdown-item-text': text\n }), cssModule);\n if (Tag === 'button') {\n if (header) {\n Tag = 'h6';\n } else if (divider) {\n Tag = 'div';\n } else if (props.href) {\n Tag = 'a';\n } else if (text) {\n Tag = 'span';\n }\n }\n return /*#__PURE__*/React.createElement(Tag, _extends({\n type: Tag === 'button' && (props.onClick || this.props.toggle) ? 'button' : undefined\n }, props, {\n tabIndex: tabIndex,\n role: role,\n className: classes,\n onClick: this.onClick\n }));\n }\n }]);\n return DropdownItem;\n}(React.Component);\nDropdownItem.propTypes = propTypes;\nDropdownItem.contextType = DropdownContext;\nexport default DropdownItem;","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _excluded = [\"className\", \"cssModule\", \"dark\", \"end\", \"right\", \"tag\", \"flip\", \"modifiers\", \"persist\", \"strategy\", \"container\", \"updateOnSelect\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\nimport classNames from 'classnames';\nimport { Popper } from 'react-popper';\nimport { DropdownContext } from './DropdownContext';\nimport { mapToCssModules, tagPropType, targetPropType, getTarget, deprecated } from './utils';\nvar propTypes = {\n tag: tagPropType,\n children: PropTypes.node.isRequired,\n dark: PropTypes.bool,\n end: PropTypes.bool,\n /** Flips the menu to the opposite side if there is not enough space to fit */\n flip: PropTypes.bool,\n modifiers: PropTypes.array,\n className: PropTypes.string,\n cssModule: PropTypes.object,\n style: PropTypes.object,\n persist: PropTypes.bool,\n strategy: PropTypes.string,\n container: targetPropType,\n /** Update popper layout when a click event comes up. This leverages event bubbling. */\n updateOnSelect: PropTypes.bool,\n right: deprecated(PropTypes.bool, 'Please use \"end\" instead.')\n};\nvar directionPositionMap = {\n up: 'top',\n left: 'left',\n right: 'right',\n start: 'left',\n end: 'right',\n down: 'bottom'\n};\nvar DropdownMenu = /*#__PURE__*/function (_React$Component) {\n _inherits(DropdownMenu, _React$Component);\n var _super = _createSuper(DropdownMenu);\n function DropdownMenu() {\n _classCallCheck(this, DropdownMenu);\n return _super.apply(this, arguments);\n }\n _createClass(DropdownMenu, [{\n key: \"getRole\",\n value: function getRole() {\n if (this.context.menuRole === 'listbox') {\n return 'listbox';\n }\n return 'menu';\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this = this;\n var _this$props = this.props,\n className = _this$props.className,\n cssModule = _this$props.cssModule,\n dark = _this$props.dark,\n end = _this$props.end,\n right = _this$props.right,\n _this$props$tag = _this$props.tag,\n tag = _this$props$tag === void 0 ? 'div' : _this$props$tag,\n _this$props$flip = _this$props.flip,\n flip = _this$props$flip === void 0 ? true : _this$props$flip,\n _this$props$modifiers = _this$props.modifiers,\n modifiers = _this$props$modifiers === void 0 ? [] : _this$props$modifiers,\n persist = _this$props.persist,\n strategy = _this$props.strategy,\n container = _this$props.container,\n updateOnSelect = _this$props.updateOnSelect,\n attrs = _objectWithoutProperties(_this$props, _excluded);\n var classes = mapToCssModules(classNames(className, 'dropdown-menu', {\n 'dropdown-menu-dark': dark,\n 'dropdown-menu-end': end || right,\n show: this.context.isOpen\n }), cssModule);\n var Tag = tag;\n if (persist || this.context.isOpen && !this.context.inNavbar) {\n var position1 = directionPositionMap[this.context.direction] || 'bottom';\n var position2 = end || right ? 'end' : 'start';\n var poperPlacement = \"\".concat(position1, \"-\").concat(position2);\n var poperModifiers = [].concat(_toConsumableArray(modifiers), [{\n name: 'flip',\n enabled: !!flip\n }]);\n var popper = /*#__PURE__*/React.createElement(Popper, {\n placement: poperPlacement,\n modifiers: poperModifiers,\n strategy: strategy\n }, function (_ref) {\n var ref = _ref.ref,\n style = _ref.style,\n placement = _ref.placement,\n update = _ref.update;\n var combinedStyle = _objectSpread(_objectSpread({}, _this.props.style), style);\n var handleRef = function handleRef(tagRef) {\n // Send the ref to `react-popper`\n ref(tagRef);\n // Send the ref to the parent Dropdown so that clicks outside\n // it will cause it to close\n var onMenuRef = _this.context.onMenuRef;\n if (onMenuRef) onMenuRef(tagRef);\n };\n return /*#__PURE__*/React.createElement(Tag, _extends({\n tabIndex: \"-1\",\n role: _this.getRole(),\n ref: handleRef\n }, attrs, {\n style: combinedStyle,\n \"aria-hidden\": !_this.context.isOpen,\n className: classes,\n \"data-popper-placement\": placement,\n onClick: function onClick() {\n return updateOnSelect && update();\n }\n }));\n });\n if (container) {\n return /*#__PURE__*/ReactDOM.createPortal(popper, getTarget(container));\n }\n return popper;\n }\n var onMenuRef = this.context.onMenuRef;\n return /*#__PURE__*/React.createElement(Tag, _extends({\n tabIndex: \"-1\",\n role: this.getRole()\n }, attrs, {\n ref: onMenuRef,\n \"aria-hidden\": !this.context.isOpen,\n className: classes,\n \"data-popper-placement\": attrs.placement\n }));\n }\n }]);\n return DropdownMenu;\n}(React.Component);\nDropdownMenu.propTypes = propTypes;\nDropdownMenu.contextType = DropdownContext;\nexport default DropdownMenu;","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _excluded = [\"className\", \"color\", \"cssModule\", \"caret\", \"split\", \"nav\", \"tag\", \"innerRef\"];\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { Reference } from 'react-popper';\nimport { DropdownContext } from './DropdownContext';\nimport { mapToCssModules, tagPropType } from './utils';\nimport Button from './Button';\nvar propTypes = {\n caret: PropTypes.bool,\n color: PropTypes.string,\n children: PropTypes.node,\n className: PropTypes.string,\n cssModule: PropTypes.object,\n disabled: PropTypes.bool,\n onClick: PropTypes.func,\n 'aria-haspopup': PropTypes.bool,\n split: PropTypes.bool,\n tag: tagPropType,\n nav: PropTypes.bool,\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])\n};\nvar defaultProps = {\n color: 'secondary',\n 'aria-haspopup': true\n};\nvar DropdownToggle = /*#__PURE__*/function (_React$Component) {\n _inherits(DropdownToggle, _React$Component);\n var _super = _createSuper(DropdownToggle);\n function DropdownToggle(props) {\n var _this;\n _classCallCheck(this, DropdownToggle);\n _this = _super.call(this, props);\n _this.onClick = _this.onClick.bind(_assertThisInitialized(_this));\n return _this;\n }\n _createClass(DropdownToggle, [{\n key: \"onClick\",\n value: function onClick(e) {\n if (this.props.disabled || this.context.disabled) {\n e.preventDefault();\n return;\n }\n if (this.props.nav && !this.props.tag) {\n e.preventDefault();\n }\n if (this.props.onClick) {\n this.props.onClick(e);\n }\n this.context.toggle(e);\n }\n }, {\n key: \"getRole\",\n value: function getRole() {\n return this.context.menuRole || this.props['aria-haspopup'];\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n var _this$props = this.props,\n className = _this$props.className,\n color = _this$props.color,\n cssModule = _this$props.cssModule,\n caret = _this$props.caret,\n split = _this$props.split,\n nav = _this$props.nav,\n tag = _this$props.tag,\n innerRef = _this$props.innerRef,\n props = _objectWithoutProperties(_this$props, _excluded);\n var ariaLabel = props['aria-label'] || 'Toggle Dropdown';\n var classes = mapToCssModules(classNames(className, {\n 'dropdown-toggle': caret || split,\n 'dropdown-toggle-split': split,\n 'nav-link': nav\n }), cssModule);\n var children = typeof props.children !== 'undefined' ? props.children : /*#__PURE__*/React.createElement(\"span\", {\n className: \"visually-hidden\"\n }, ariaLabel);\n var Tag;\n if (nav && !tag) {\n Tag = 'a';\n props.href = '#';\n } else if (!tag) {\n Tag = Button;\n props.color = color;\n props.cssModule = cssModule;\n } else {\n Tag = tag;\n }\n if (this.context.inNavbar) {\n return /*#__PURE__*/React.createElement(Tag, _extends({}, props, {\n className: classes,\n onClick: this.onClick,\n ref: this.context.onToggleRef,\n \"aria-expanded\": this.context.isOpen,\n \"aria-haspopup\": this.getRole(),\n children: children\n }));\n }\n return /*#__PURE__*/React.createElement(Reference, {\n innerRef: innerRef\n }, function (_ref) {\n var ref = _ref.ref;\n var handleRef = function handleRef(tagRef) {\n ref(tagRef);\n var onToggleRef = _this2.context.onToggleRef;\n if (onToggleRef) onToggleRef(tagRef);\n };\n return /*#__PURE__*/React.createElement(Tag, _extends({}, props, _defineProperty({}, typeof Tag === 'string' ? 'ref' : 'innerRef', handleRef), {\n className: classes,\n onClick: _this2.onClick,\n \"aria-expanded\": _this2.context.isOpen,\n \"aria-haspopup\": _this2.getRole(),\n children: children\n }));\n });\n }\n }]);\n return DropdownToggle;\n}(React.Component);\nDropdownToggle.propTypes = propTypes;\nDropdownToggle.defaultProps = defaultProps;\nDropdownToggle.contextType = DropdownContext;\nexport default DropdownToggle;","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport Dropdown from './Dropdown';\nimport { omit } from './utils';\nvar omitKeys = ['defaultOpen'];\nvar UncontrolledDropdown = /*#__PURE__*/function (_Component) {\n _inherits(UncontrolledDropdown, _Component);\n var _super = _createSuper(UncontrolledDropdown);\n function UncontrolledDropdown(props) {\n var _this;\n _classCallCheck(this, UncontrolledDropdown);\n _this = _super.call(this, props);\n _this.state = {\n isOpen: props.defaultOpen || false\n };\n _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));\n return _this;\n }\n _createClass(UncontrolledDropdown, [{\n key: \"toggle\",\n value: function toggle(e) {\n var _this2 = this;\n this.setState(function (prevState) {\n return {\n isOpen: !prevState.isOpen\n };\n }, function () {\n if (_this2.props.onToggle) {\n _this2.props.onToggle(e, _this2.state.isOpen);\n }\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(Dropdown, _extends({\n isOpen: this.state.isOpen,\n toggle: this.toggle\n }, omit(this.props, omitKeys)));\n }\n }]);\n return UncontrolledDropdown;\n}(Component);\nexport { UncontrolledDropdown as default };\nUncontrolledDropdown.propTypes = _objectSpread({\n defaultOpen: PropTypes.bool,\n onToggle: PropTypes.func\n}, Dropdown.propTypes);","/**\n * @remix-run/router v1.8.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Actions represent the type of change to a location value.\n */\nvar Action;\n(function (Action) {\n /**\n * A POP indicates a change to an arbitrary index in the history stack, such\n * as a back or forward navigation. It does not describe the direction of the\n * navigation, only that the current index changed.\n *\n * Note: This is the default action for newly created history objects.\n */\n Action[\"Pop\"] = \"POP\";\n /**\n * A PUSH indicates a new entry being added to the history stack, such as when\n * a link is clicked and a new page loads. When this happens, all subsequent\n * entries in the stack are lost.\n */\n Action[\"Push\"] = \"PUSH\";\n /**\n * A REPLACE indicates the entry at the current index in the history stack\n * being replaced by a new one.\n */\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\nconst PopStateEventType = \"popstate\";\n/**\n * Memory history stores the current location in memory. It is designed for use\n * in stateful non-browser environments like tests and React Native.\n */\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n let {\n initialEntries = [\"/\"],\n initialIndex,\n v5Compat = false\n } = options;\n let entries; // Declare so we can access from createMemoryLocation\n entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === \"string\" ? null : entry.state, index === 0 ? \"default\" : undefined));\n let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);\n let action = Action.Pop;\n let listener = null;\n function clampIndex(n) {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation() {\n return entries[index];\n }\n function createMemoryLocation(to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = createLocation(entries ? getCurrentLocation().pathname : \"/\", to, state, key);\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in memory history: \" + JSON.stringify(to));\n return location;\n }\n function createHref(to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n let history = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\"\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 1\n });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 0\n });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: nextLocation,\n delta\n });\n }\n },\n listen(fn) {\n listener = fn;\n return () => {\n listener = null;\n };\n }\n };\n return history;\n}\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createBrowserLocation(window, globalHistory) {\n let {\n pathname,\n search,\n hash\n } = window.location;\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createBrowserHref(window, to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);\n}\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createHashLocation(window, globalHistory) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = parsePath(window.location.hash.substr(1));\n // Hash URL should always have a leading / just like window.location.pathname\n // does, so if an app ends up at a route like /#something then we add a\n // leading slash so all of our path-matching behaves the same as if it would\n // in a browser router. This is particularly important when there exists a\n // root splat route () since that matches internally against\n // \"/*\" and we'd expect /#something to 404 in a hash router app.\n if (!pathname.startsWith(\"/\") && !pathname.startsWith(\".\")) {\n pathname = \"/\" + pathname;\n }\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createHashHref(window, to) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n function validateHashLocation(location, to) {\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\");\n }\n return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);\n}\nfunction invariant(value, message) {\n if (value === false || value === null || typeof value === \"undefined\") {\n throw new Error(message);\n }\n}\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\n * For browser-based histories, we combine the state and key into an object\n */\nfunction getHistoryState(location, index) {\n return {\n usr: location.state,\n key: location.key,\n idx: index\n };\n}\n/**\n * Creates a Location object with a unique key from the given Path\n */\nfunction createLocation(current, to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = _extends({\n pathname: typeof current === \"string\" ? current : current.pathname,\n search: \"\",\n hash: \"\"\n }, typeof to === \"string\" ? parsePath(to) : to, {\n state,\n // TODO: This could be cleaned up. push/replace should probably just take\n // full Locations now and avoid the need to run through this flow at all\n // But that's a pretty big refactor to the current test suite so going to\n // keep as is for the time being and just let any incoming keys take precedence\n key: to && to.key || key || createKey()\n });\n return location;\n}\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\nfunction createPath(_ref) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = _ref;\n if (search && search !== \"?\") pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n if (hash && hash !== \"#\") pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n return pathname;\n}\n/**\n * Parses a string URL path into its separate pathname, search, and hash components.\n */\nfunction parsePath(path) {\n let parsedPath = {};\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n let searchIndex = path.indexOf(\"?\");\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n if (path) {\n parsedPath.pathname = path;\n }\n }\n return parsedPath;\n}\nfunction getUrlBasedHistory(getLocation, createHref, validateLocation, options) {\n if (options === void 0) {\n options = {};\n }\n let {\n window = document.defaultView,\n v5Compat = false\n } = options;\n let globalHistory = window.history;\n let action = Action.Pop;\n let listener = null;\n let index = getIndex();\n // Index should only be null when we initialize. If not, it's because the\n // user called history.pushState or history.replaceState directly, in which\n // case we should log a warning as it will result in bugs.\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), \"\");\n }\n function getIndex() {\n let state = globalHistory.state || {\n idx: null\n };\n return state.idx;\n }\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: history.location,\n delta\n });\n }\n }\n function push(to, state) {\n action = Action.Push;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex() + 1;\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n // try...catch because iOS limits us to 100 pushState calls :/\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\n // If the exception is because `state` can't be serialized, let that throw\n // outwards just like a replace call would so the dev knows the cause\n // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps\n // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal\n if (error instanceof DOMException && error.name === \"DataCloneError\") {\n throw error;\n }\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 1\n });\n }\n }\n function replace(to, state) {\n action = Action.Replace;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex();\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n globalHistory.replaceState(historyState, \"\", url);\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 0\n });\n }\n }\n function createURL(to) {\n // window.location.origin is \"null\" (the literal string value) in Firefox\n // under certain conditions, notably when serving from a local HTML file\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297\n let base = window.location.origin !== \"null\" ? window.location.origin : window.location.href;\n let href = typeof to === \"string\" ? to : createPath(to);\n invariant(base, \"No window.location.(origin|href) available to create URL for href: \" + href);\n return new URL(href, base);\n }\n let history = {\n get action() {\n return action;\n },\n get location() {\n return getLocation(window, globalHistory);\n },\n listen(fn) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n createHref(to) {\n return createHref(window, to);\n },\n createURL,\n encodeLocation(to) {\n // Encode a Location the same way window.location would\n let url = createURL(to);\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash\n };\n },\n push,\n replace,\n go(n) {\n return globalHistory.go(n);\n }\n };\n return history;\n}\n//#endregion\n\nvar ResultType;\n(function (ResultType) {\n ResultType[\"data\"] = \"data\";\n ResultType[\"deferred\"] = \"deferred\";\n ResultType[\"redirect\"] = \"redirect\";\n ResultType[\"error\"] = \"error\";\n})(ResultType || (ResultType = {}));\nconst immutableRouteKeys = new Set([\"lazy\", \"caseSensitive\", \"path\", \"id\", \"index\", \"children\"]);\nfunction isIndexRoute(route) {\n return route.index === true;\n}\n// Walk the route tree generating unique IDs where necessary so we are working\n// solely with AgnosticDataRouteObject's within the Router\nfunction convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n if (manifest === void 0) {\n manifest = {};\n }\n return routes.map((route, index) => {\n let treePath = [...parentPath, index];\n let id = typeof route.id === \"string\" ? route.id : treePath.join(\"-\");\n invariant(route.index !== true || !route.children, \"Cannot specify children on an index route\");\n invariant(!manifest[id], \"Found a route id collision on id \\\"\" + id + \"\\\". Route \" + \"id's must be globally unique within Data Router usages\");\n if (isIndexRoute(route)) {\n let indexRoute = _extends({}, route, mapRouteProperties(route), {\n id\n });\n manifest[id] = indexRoute;\n return indexRoute;\n } else {\n let pathOrLayoutRoute = _extends({}, route, mapRouteProperties(route), {\n id,\n children: undefined\n });\n manifest[id] = pathOrLayoutRoute;\n if (route.children) {\n pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest);\n }\n return pathOrLayoutRoute;\n }\n });\n}\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/utils/match-routes\n */\nfunction matchRoutes(routes, locationArg, basename) {\n if (basename === void 0) {\n basename = \"/\";\n }\n let location = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n let pathname = stripBasename(location.pathname || \"/\", basename);\n if (pathname == null) {\n return null;\n }\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n let matches = null;\n for (let i = 0; matches == null && i < branches.length; ++i) {\n matches = matchRouteBranch(branches[i],\n // Incoming pathnames are generally encoded from either window.location\n // or from router.navigate, but we want to match against the unencoded\n // paths in the route definitions. Memory router locations won't be\n // encoded here but there also shouldn't be anything to decode so this\n // should be a safe operation. This avoids needing matchRoutes to be\n // history-aware.\n safelyDecodeURI(pathname));\n }\n return matches;\n}\nfunction flattenRoutes(routes, branches, parentsMeta, parentPath) {\n if (branches === void 0) {\n branches = [];\n }\n if (parentsMeta === void 0) {\n parentsMeta = [];\n }\n if (parentPath === void 0) {\n parentPath = \"\";\n }\n let flattenRoute = (route, index, relativePath) => {\n let meta = {\n relativePath: relativePath === undefined ? route.path || \"\" : relativePath,\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route\n };\n if (meta.relativePath.startsWith(\"/\")) {\n invariant(meta.relativePath.startsWith(parentPath), \"Absolute route path \\\"\" + meta.relativePath + \"\\\" nested under path \" + (\"\\\"\" + parentPath + \"\\\" is not valid. An absolute child route path \") + \"must start with the combined path of all its parent routes.\");\n meta.relativePath = meta.relativePath.slice(parentPath.length);\n }\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta);\n // Add the children before adding this route to the array so we traverse the\n // route tree depth-first and child routes appear before their parents in\n // the \"flattened\" version.\n if (route.children && route.children.length > 0) {\n invariant(\n // Our types know better, but runtime JS may not!\n // @ts-expect-error\n route.index !== true, \"Index routes must not have child routes. Please remove \" + (\"all child routes from route path \\\"\" + path + \"\\\".\"));\n flattenRoutes(route.children, branches, routesMeta, path);\n }\n // Routes without a path shouldn't ever match by themselves unless they are\n // index routes, so don't add them to the list of possible branches.\n if (route.path == null && !route.index) {\n return;\n }\n branches.push({\n path,\n score: computeScore(path, route.index),\n routesMeta\n });\n };\n routes.forEach((route, index) => {\n var _route$path;\n // coarse-grain check for optional params\n if (route.path === \"\" || !((_route$path = route.path) != null && _route$path.includes(\"?\"))) {\n flattenRoute(route, index);\n } else {\n for (let exploded of explodeOptionalSegments(route.path)) {\n flattenRoute(route, index, exploded);\n }\n }\n });\n return branches;\n}\n/**\n * Computes all combinations of optional path segments for a given path,\n * excluding combinations that are ambiguous and of lower priority.\n *\n * For example, `/one/:two?/three/:four?/:five?` explodes to:\n * - `/one/three`\n * - `/one/:two/three`\n * - `/one/three/:four`\n * - `/one/three/:five`\n * - `/one/:two/three/:four`\n * - `/one/:two/three/:five`\n * - `/one/three/:four/:five`\n * - `/one/:two/three/:four/:five`\n */\nfunction explodeOptionalSegments(path) {\n let segments = path.split(\"/\");\n if (segments.length === 0) return [];\n let [first, ...rest] = segments;\n // Optional path segments are denoted by a trailing `?`\n let isOptional = first.endsWith(\"?\");\n // Compute the corresponding required segment: `foo?` -> `foo`\n let required = first.replace(/\\?$/, \"\");\n if (rest.length === 0) {\n // Intepret empty string as omitting an optional segment\n // `[\"one\", \"\", \"three\"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three`\n return isOptional ? [required, \"\"] : [required];\n }\n let restExploded = explodeOptionalSegments(rest.join(\"/\"));\n let result = [];\n // All child paths with the prefix. Do this for all children before the\n // optional version for all children so we get consistent ordering where the\n // parent optional aspect is preferred as required. Otherwise, we can get\n // child sections interspersed where deeper optional segments are higher than\n // parent optional segments, where for example, /:two would explodes _earlier_\n // then /:one. By always including the parent as required _for all children_\n // first, we avoid this issue\n result.push(...restExploded.map(subpath => subpath === \"\" ? required : [required, subpath].join(\"/\")));\n // Then if this is an optional value, add all child versions without\n if (isOptional) {\n result.push(...restExploded);\n }\n // for absolute paths, ensure `/` instead of empty segment\n return result.map(exploded => path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded);\n}\nfunction rankRouteBranches(branches) {\n branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first\n : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));\n}\nconst paramRe = /^:\\w+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = s => s === \"*\";\nfunction computeScore(path, index) {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n if (index) {\n initialScore += indexRouteValue;\n }\n return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === \"\" ? emptySegmentValue : staticSegmentValue), initialScore);\n}\nfunction compareIndexes(a, b) {\n let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);\n return siblings ?\n // If two routes are siblings, we should try to match the earlier sibling\n // first. This allows people to have fine-grained control over the matching\n // behavior by simply putting routes with identical paths in the order they\n // want them tried.\n a[a.length - 1] - b[b.length - 1] :\n // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\nfunction matchRouteBranch(branch, pathname) {\n let {\n routesMeta\n } = branch;\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches = [];\n for (let i = 0; i < routesMeta.length; ++i) {\n let meta = routesMeta[i];\n let end = i === routesMeta.length - 1;\n let remainingPathname = matchedPathname === \"/\" ? pathname : pathname.slice(matchedPathname.length) || \"/\";\n let match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end\n }, remainingPathname);\n if (!match) return null;\n Object.assign(matchedParams, match.params);\n let route = meta.route;\n matches.push({\n // TODO: Can this as be avoided?\n params: matchedParams,\n pathname: joinPaths([matchedPathname, match.pathname]),\n pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),\n route\n });\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n return matches;\n}\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/utils/generate-path\n */\nfunction generatePath(originalPath, params) {\n if (params === void 0) {\n params = {};\n }\n let path = originalPath;\n if (path.endsWith(\"*\") && path !== \"*\" && !path.endsWith(\"/*\")) {\n warning(false, \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n path = path.replace(/\\*$/, \"/*\");\n }\n // ensure `/` is added at the beginning if the path is absolute\n const prefix = path.startsWith(\"/\") ? \"/\" : \"\";\n const stringify = p => p == null ? \"\" : typeof p === \"string\" ? p : String(p);\n const segments = path.split(/\\/+/).map((segment, index, array) => {\n const isLastSegment = index === array.length - 1;\n // only apply the splat if it's the last segment\n if (isLastSegment && segment === \"*\") {\n const star = \"*\";\n // Apply the splat\n return stringify(params[star]);\n }\n const keyMatch = segment.match(/^:(\\w+)(\\??)$/);\n if (keyMatch) {\n const [, key, optional] = keyMatch;\n let param = params[key];\n invariant(optional === \"?\" || param != null, \"Missing \\\":\" + key + \"\\\" param\");\n return stringify(param);\n }\n // Remove any optional markers from optional static segments\n return segment.replace(/\\?$/g, \"\");\n })\n // Remove empty segments\n .filter(segment => !!segment);\n return prefix + segments.join(\"/\");\n}\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/utils/match-path\n */\nfunction matchPath(pattern, pathname) {\n if (typeof pattern === \"string\") {\n pattern = {\n path: pattern,\n caseSensitive: false,\n end: true\n };\n }\n let [matcher, paramNames] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);\n let match = pathname.match(matcher);\n if (!match) return null;\n let matchedPathname = match[0];\n let pathnameBase = matchedPathname.replace(/(.)\\/+$/, \"$1\");\n let captureGroups = match.slice(1);\n let params = paramNames.reduce((memo, paramName, index) => {\n // We need to compute the pathnameBase here using the raw splat value\n // instead of using params[\"*\"] later because it will be decoded then\n if (paramName === \"*\") {\n let splatValue = captureGroups[index] || \"\";\n pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\\/+$/, \"$1\");\n }\n memo[paramName] = safelyDecodeURIComponent(captureGroups[index] || \"\", paramName);\n return memo;\n }, {});\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern\n };\n}\nfunction compilePath(path, caseSensitive, end) {\n if (caseSensitive === void 0) {\n caseSensitive = false;\n }\n if (end === void 0) {\n end = true;\n }\n warning(path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"), \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n let paramNames = [];\n let regexpSource = \"^\" + path.replace(/\\/*\\*?$/, \"\") // Ignore trailing / and /*, we'll handle it below\n .replace(/^\\/*/, \"/\") // Make sure it has a leading /\n .replace(/[\\\\.*+^$?{}|()[\\]]/g, \"\\\\$&\") // Escape special regex chars\n .replace(/\\/:(\\w+)/g, (_, paramName) => {\n paramNames.push(paramName);\n return \"/([^\\\\/]+)\";\n });\n if (path.endsWith(\"*\")) {\n paramNames.push(\"*\");\n regexpSource += path === \"*\" || path === \"/*\" ? \"(.*)$\" // Already matched the initial /, just match the rest\n : \"(?:\\\\/(.+)|\\\\/*)$\"; // Don't include the / in params[\"*\"]\n } else if (end) {\n // When matching to the end, ignore trailing slashes\n regexpSource += \"\\\\/*$\";\n } else if (path !== \"\" && path !== \"/\") {\n // If our path is non-empty and contains anything beyond an initial slash,\n // then we have _some_ form of path in our regex so we should expect to\n // match only if we find the end of this path segment. Look for an optional\n // non-captured trailing slash (to match a portion of the URL) or the end\n // of the path (if we've matched to the end). We used to do this with a\n // word boundary but that gives false positives on routes like\n // /user-preferences since `-` counts as a word boundary.\n regexpSource += \"(?:(?=\\\\/|$))\";\n } else ;\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n return [matcher, paramNames];\n}\nfunction safelyDecodeURI(value) {\n try {\n return decodeURI(value);\n } catch (error) {\n warning(false, \"The URL path \\\"\" + value + \"\\\" could not be decoded because it is is a \" + \"malformed URL segment. This is probably due to a bad percent \" + (\"encoding (\" + error + \").\"));\n return value;\n }\n}\nfunction safelyDecodeURIComponent(value, paramName) {\n try {\n return decodeURIComponent(value);\n } catch (error) {\n warning(false, \"The value for the URL param \\\"\" + paramName + \"\\\" will not be decoded because\" + (\" the string \\\"\" + value + \"\\\" is a malformed URL segment. This is probably\") + (\" due to a bad percent encoding (\" + error + \").\"));\n return value;\n }\n}\n/**\n * @private\n */\nfunction stripBasename(pathname, basename) {\n if (basename === \"/\") return pathname;\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n let startIndex = basename.endsWith(\"/\") ? basename.length - 1 : basename.length;\n let nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n return pathname.slice(startIndex) || \"/\";\n}\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/utils/resolve-path\n */\nfunction resolvePath(to, fromPathname) {\n if (fromPathname === void 0) {\n fromPathname = \"/\";\n }\n let {\n pathname: toPathname,\n search = \"\",\n hash = \"\"\n } = typeof to === \"string\" ? parsePath(to) : to;\n let pathname = toPathname ? toPathname.startsWith(\"/\") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;\n return {\n pathname,\n search: normalizeSearch(search),\n hash: normalizeHash(hash)\n };\n}\nfunction resolvePathname(relativePath, fromPathname) {\n let segments = fromPathname.replace(/\\/+$/, \"\").split(\"/\");\n let relativeSegments = relativePath.split(\"/\");\n relativeSegments.forEach(segment => {\n if (segment === \"..\") {\n // Keep the root \"\" segment so the pathname starts at /\n if (segments.length > 1) segments.pop();\n } else if (segment !== \".\") {\n segments.push(segment);\n }\n });\n return segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\nfunction getInvalidPathError(char, field, dest, path) {\n return \"Cannot include a '\" + char + \"' character in a manually specified \" + (\"`to.\" + field + \"` field [\" + JSON.stringify(path) + \"]. Please separate it out to the \") + (\"`to.\" + dest + \"` field. Alternatively you may provide the full path as \") + \"a string in and the router will parse it for you.\";\n}\n/**\n * @private\n *\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * \n * \n * \n *\n * \n * \n * }> // <-- Does not contribute\n * // <-- Does not contribute\n * \n * \n */\nfunction getPathContributingMatches(matches) {\n return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);\n}\n/**\n * @private\n */\nfunction resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {\n if (isPathRelative === void 0) {\n isPathRelative = false;\n }\n let to;\n if (typeof toArg === \"string\") {\n to = parsePath(toArg);\n } else {\n to = _extends({}, toArg);\n invariant(!to.pathname || !to.pathname.includes(\"?\"), getInvalidPathError(\"?\", \"pathname\", \"search\", to));\n invariant(!to.pathname || !to.pathname.includes(\"#\"), getInvalidPathError(\"#\", \"pathname\", \"hash\", to));\n invariant(!to.search || !to.search.includes(\"#\"), getInvalidPathError(\"#\", \"search\", \"hash\", to));\n }\n let isEmptyPath = toArg === \"\" || to.pathname === \"\";\n let toPathname = isEmptyPath ? \"/\" : to.pathname;\n let from;\n // Routing is relative to the current pathname if explicitly requested.\n //\n // If a pathname is explicitly provided in `to`, it should be relative to the\n // route context. This is explained in `Note on `` values` in our\n // migration guide from v5 as a means of disambiguation between `to` values\n // that begin with `/` and those that do not. However, this is problematic for\n // `to` values that do not provide a pathname. `to` can simply be a search or\n // hash string, in which case we should assume that the navigation is relative\n // to the current location's pathname and *not* the route pathname.\n if (isPathRelative || toPathname == null) {\n from = locationPathname;\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n if (toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n // Each leading .. segment means \"go up one route\" instead of \"go up one\n // URL segment\". This is a key difference from how works and a\n // major reason we call this a \"to\" value instead of a \"href\".\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n to.pathname = toSegments.join(\"/\");\n }\n // If there are more \"..\" segments than parent routes, resolve relative to\n // the root / URL.\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n let path = resolvePath(to, from);\n // Ensure the pathname has a trailing slash if the original \"to\" had one\n let hasExplicitTrailingSlash = toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\");\n // Or if this was a link to the current path which has a trailing slash\n let hasCurrentTrailingSlash = (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n if (!path.pathname.endsWith(\"/\") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {\n path.pathname += \"/\";\n }\n return path;\n}\n/**\n * @private\n */\nfunction getToPathname(to) {\n // Empty strings should be treated the same as / paths\n return to === \"\" || to.pathname === \"\" ? \"/\" : typeof to === \"string\" ? parsePath(to).pathname : to.pathname;\n}\n/**\n * @private\n */\nconst joinPaths = paths => paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\n/**\n * @private\n */\nconst normalizePathname = pathname => pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n/**\n * @private\n */\nconst normalizeSearch = search => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\n/**\n * @private\n */\nconst normalizeHash = hash => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n/**\n * This is a shortcut for creating `application/json` responses. Converts `data`\n * to JSON and sets the `Content-Type` header.\n */\nconst json = function json(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n let headers = new Headers(responseInit.headers);\n if (!headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json; charset=utf-8\");\n }\n return new Response(JSON.stringify(data), _extends({}, responseInit, {\n headers\n }));\n};\nclass AbortedDeferredError extends Error {}\nclass DeferredData {\n constructor(data, responseInit) {\n this.pendingKeysSet = new Set();\n this.subscribers = new Set();\n this.deferredKeys = [];\n invariant(data && typeof data === \"object\" && !Array.isArray(data), \"defer() only accepts plain objects\");\n // Set up an AbortController + Promise we can race against to exit early\n // cancellation\n let reject;\n this.abortPromise = new Promise((_, r) => reject = r);\n this.controller = new AbortController();\n let onAbort = () => reject(new AbortedDeferredError(\"Deferred data aborted\"));\n this.unlistenAbortSignal = () => this.controller.signal.removeEventListener(\"abort\", onAbort);\n this.controller.signal.addEventListener(\"abort\", onAbort);\n this.data = Object.entries(data).reduce((acc, _ref) => {\n let [key, value] = _ref;\n return Object.assign(acc, {\n [key]: this.trackPromise(key, value)\n });\n }, {});\n if (this.done) {\n // All incoming values were resolved\n this.unlistenAbortSignal();\n }\n this.init = responseInit;\n }\n trackPromise(key, value) {\n if (!(value instanceof Promise)) {\n return value;\n }\n this.deferredKeys.push(key);\n this.pendingKeysSet.add(key);\n // We store a little wrapper promise that will be extended with\n // _data/_error props upon resolve/reject\n let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, undefined, data), error => this.onSettle(promise, key, error));\n // Register rejection listeners to avoid uncaught promise rejections on\n // errors or aborted deferred values\n promise.catch(() => {});\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n return promise;\n }\n onSettle(promise, key, error, data) {\n if (this.controller.signal.aborted && error instanceof AbortedDeferredError) {\n this.unlistenAbortSignal();\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n return Promise.reject(error);\n }\n this.pendingKeysSet.delete(key);\n if (this.done) {\n // Nothing left to abort!\n this.unlistenAbortSignal();\n }\n // If the promise was resolved/rejected with undefined, we'll throw an error as you\n // should always resolve with a value or null\n if (error === undefined && data === undefined) {\n let undefinedError = new Error(\"Deferred data for key \\\"\" + key + \"\\\" resolved/rejected with `undefined`, \" + \"you must resolve/reject with a value or `null`.\");\n Object.defineProperty(promise, \"_error\", {\n get: () => undefinedError\n });\n this.emit(false, key);\n return Promise.reject(undefinedError);\n }\n if (data === undefined) {\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n this.emit(false, key);\n return Promise.reject(error);\n }\n Object.defineProperty(promise, \"_data\", {\n get: () => data\n });\n this.emit(false, key);\n return data;\n }\n emit(aborted, settledKey) {\n this.subscribers.forEach(subscriber => subscriber(aborted, settledKey));\n }\n subscribe(fn) {\n this.subscribers.add(fn);\n return () => this.subscribers.delete(fn);\n }\n cancel() {\n this.controller.abort();\n this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));\n this.emit(true);\n }\n async resolveData(signal) {\n let aborted = false;\n if (!this.done) {\n let onAbort = () => this.cancel();\n signal.addEventListener(\"abort\", onAbort);\n aborted = await new Promise(resolve => {\n this.subscribe(aborted => {\n signal.removeEventListener(\"abort\", onAbort);\n if (aborted || this.done) {\n resolve(aborted);\n }\n });\n });\n }\n return aborted;\n }\n get done() {\n return this.pendingKeysSet.size === 0;\n }\n get unwrappedData() {\n invariant(this.data !== null && this.done, \"Can only unwrap data on initialized and settled deferreds\");\n return Object.entries(this.data).reduce((acc, _ref2) => {\n let [key, value] = _ref2;\n return Object.assign(acc, {\n [key]: unwrapTrackedPromise(value)\n });\n }, {});\n }\n get pendingKeys() {\n return Array.from(this.pendingKeysSet);\n }\n}\nfunction isTrackedPromise(value) {\n return value instanceof Promise && value._tracked === true;\n}\nfunction unwrapTrackedPromise(value) {\n if (!isTrackedPromise(value)) {\n return value;\n }\n if (value._error) {\n throw value._error;\n }\n return value._data;\n}\nconst defer = function defer(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n return new DeferredData(data, responseInit);\n};\n/**\n * A redirect response. Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirect = function redirect(url, init) {\n if (init === void 0) {\n init = 302;\n }\n let responseInit = init;\n if (typeof responseInit === \"number\") {\n responseInit = {\n status: responseInit\n };\n } else if (typeof responseInit.status === \"undefined\") {\n responseInit.status = 302;\n }\n let headers = new Headers(responseInit.headers);\n headers.set(\"Location\", url);\n return new Response(null, _extends({}, responseInit, {\n headers\n }));\n};\n/**\n * A redirect response that will force a document reload to the new location.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirectDocument = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Reload-Document\", \"true\");\n return response;\n};\n/**\n * @private\n * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies\n */\nclass ErrorResponse {\n constructor(status, statusText, data, internal) {\n if (internal === void 0) {\n internal = false;\n }\n this.status = status;\n this.statusText = statusText || \"\";\n this.internal = internal;\n if (data instanceof Error) {\n this.data = data.toString();\n this.error = data;\n } else {\n this.data = data;\n }\n }\n}\n/**\n * Check if the given error is an ErrorResponse generated from a 4xx/5xx\n * Response thrown from an action/loader\n */\nfunction isRouteErrorResponse(error) {\n return error != null && typeof error.status === \"number\" && typeof error.statusText === \"string\" && typeof error.internal === \"boolean\" && \"data\" in error;\n}\n\nconst validMutationMethodsArr = [\"post\", \"put\", \"patch\", \"delete\"];\nconst validMutationMethods = new Set(validMutationMethodsArr);\nconst validRequestMethodsArr = [\"get\", ...validMutationMethodsArr];\nconst validRequestMethods = new Set(validRequestMethodsArr);\nconst redirectStatusCodes = new Set([301, 302, 303, 307, 308]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\nconst IDLE_NAVIGATION = {\n state: \"idle\",\n location: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_FETCHER = {\n state: \"idle\",\n data: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_BLOCKER = {\n state: \"unblocked\",\n proceed: undefined,\n reset: undefined,\n location: undefined\n};\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst defaultMapRouteProperties = route => ({\n hasErrorBoundary: Boolean(route.hasErrorBoundary)\n});\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createRouter\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Create a router and listen to history POP navigations\n */\nfunction createRouter(init) {\n const routerWindow = init.window ? init.window : typeof window !== \"undefined\" ? window : undefined;\n const isBrowser = typeof routerWindow !== \"undefined\" && typeof routerWindow.document !== \"undefined\" && typeof routerWindow.document.createElement !== \"undefined\";\n const isServer = !isBrowser;\n invariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n let mapRouteProperties;\n if (init.mapRouteProperties) {\n mapRouteProperties = init.mapRouteProperties;\n } else if (init.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = init.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Routes keyed by ID\n let manifest = {};\n // Routes in tree format for matching\n let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, undefined, manifest);\n let inFlightDataRoutes;\n let basename = init.basename || \"/\";\n // Config driven behavior flags\n let future = _extends({\n v7_normalizeFormMethod: false,\n v7_prependBasename: false\n }, init.future);\n // Cleanup function for history\n let unlistenHistory = null;\n // Externally-provided functions to call on all state changes\n let subscribers = new Set();\n // Externally-provided object to hold scroll restoration locations during routing\n let savedScrollPositions = null;\n // Externally-provided function to get scroll restoration keys\n let getScrollRestorationKey = null;\n // Externally-provided function to get current scroll position\n let getScrollPosition = null;\n // One-time flag to control the initial hydration scroll restoration. Because\n // we don't get the saved positions from until _after_\n // the initial render, we need to manually trigger a separate updateState to\n // send along the restoreScrollPosition\n // Set to true if we have `hydrationData` since we assume we were SSR'd and that\n // SSR did the initial scroll restoration.\n let initialScrollRestored = init.hydrationData != null;\n let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);\n let initialErrors = null;\n if (initialMatches == null) {\n // If we do not match a user-provided-route, fall back to the root\n // to allow the error boundary to take over\n let error = getInternalRouterError(404, {\n pathname: init.history.location.pathname\n });\n let {\n matches,\n route\n } = getShortCircuitMatches(dataRoutes);\n initialMatches = matches;\n initialErrors = {\n [route.id]: error\n };\n }\n let initialized =\n // All initialMatches need to be loaded before we're ready. If we have lazy\n // functions around still then we'll need to run them in initialize()\n !initialMatches.some(m => m.route.lazy) && (\n // And we have to either have no loaders or have been provided hydrationData\n !initialMatches.some(m => m.route.loader) || init.hydrationData != null);\n let router;\n let state = {\n historyAction: init.history.action,\n location: init.history.location,\n matches: initialMatches,\n initialized,\n navigation: IDLE_NAVIGATION,\n // Don't restore on initial updateState() if we were SSR'd\n restoreScrollPosition: init.hydrationData != null ? false : null,\n preventScrollReset: false,\n revalidation: \"idle\",\n loaderData: init.hydrationData && init.hydrationData.loaderData || {},\n actionData: init.hydrationData && init.hydrationData.actionData || null,\n errors: init.hydrationData && init.hydrationData.errors || initialErrors,\n fetchers: new Map(),\n blockers: new Map()\n };\n // -- Stateful internal variables to manage navigations --\n // Current navigation in progress (to be committed in completeNavigation)\n let pendingAction = Action.Pop;\n // Should the current navigation prevent the scroll reset if scroll cannot\n // be restored?\n let pendingPreventScrollReset = false;\n // AbortController for the active navigation\n let pendingNavigationController;\n // We use this to avoid touching history in completeNavigation if a\n // revalidation is entirely uninterrupted\n let isUninterruptedRevalidation = false;\n // Use this internal flag to force revalidation of all loaders:\n // - submissions (completed or interrupted)\n // - useRevalidator()\n // - X-Remix-Revalidate (from redirect)\n let isRevalidationRequired = false;\n // Use this internal array to capture routes that require revalidation due\n // to a cancelled deferred on action submission\n let cancelledDeferredRoutes = [];\n // Use this internal array to capture fetcher loads that were cancelled by an\n // action navigation and require revalidation\n let cancelledFetcherLoads = [];\n // AbortControllers for any in-flight fetchers\n let fetchControllers = new Map();\n // Track loads based on the order in which they started\n let incrementingLoadId = 0;\n // Track the outstanding pending navigation data load to be compared against\n // the globally incrementing load when a fetcher load lands after a completed\n // navigation\n let pendingNavigationLoadId = -1;\n // Fetchers that triggered data reloads as a result of their actions\n let fetchReloadIds = new Map();\n // Fetchers that triggered redirect navigations\n let fetchRedirectIds = new Set();\n // Most recent href/match for fetcher.load calls for fetchers\n let fetchLoadMatches = new Map();\n // Store DeferredData instances for active route matches. When a\n // route loader returns defer() we stick one in here. Then, when a nested\n // promise resolves we update loaderData. If a new navigation starts we\n // cancel active deferreds for eliminated routes.\n let activeDeferreds = new Map();\n // Store blocker functions in a separate Map outside of router state since\n // we don't need to update UI state if they change\n let blockerFunctions = new Map();\n // Flag to ignore the next history update, so we can revert the URL change on\n // a POP navigation that was blocked by the user without touching router state\n let ignoreNextHistoryUpdate = false;\n // Initialize the router, all side effects should be kicked off from here.\n // Implemented as a Fluent API for ease of:\n // let router = createRouter(init).initialize();\n function initialize() {\n // If history informs us of a POP navigation, start the navigation but do not update\n // state. We'll update our own state once the navigation completes\n unlistenHistory = init.history.listen(_ref => {\n let {\n action: historyAction,\n location,\n delta\n } = _ref;\n // Ignore this event if it was just us resetting the URL from a\n // blocked POP navigation\n if (ignoreNextHistoryUpdate) {\n ignoreNextHistoryUpdate = false;\n return;\n }\n warning(blockerFunctions.size === 0 || delta != null, \"You are trying to use a blocker on a POP navigation to a location \" + \"that was not created by @remix-run/router. This will fail silently in \" + \"production. This can happen if you are navigating outside the router \" + \"via `window.history.pushState`/`window.location.hash` instead of using \" + \"router navigation APIs. This can also happen if you are using \" + \"createHashRouter and the user manually changes the URL.\");\n let blockerKey = shouldBlockNavigation({\n currentLocation: state.location,\n nextLocation: location,\n historyAction\n });\n if (blockerKey && delta != null) {\n // Restore the URL to match the current UI, but don't update router state\n ignoreNextHistoryUpdate = true;\n init.history.go(delta * -1);\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location\n });\n // Re-do the same POP navigation we just blocked\n init.history.go(delta);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return startNavigation(historyAction, location);\n });\n // Kick off initial data load if needed. Use Pop to avoid modifying history\n // Note we don't do any handling of lazy here. For SPA's it'll get handled\n // in the normal navigation flow. For SSR it's expected that lazy modules are\n // resolved prior to router creation since we can't go into a fallbackElement\n // UI for SSR'd apps\n if (!state.initialized) {\n startNavigation(Action.Pop, state.location);\n }\n return router;\n }\n // Clean up a router and it's side effects\n function dispose() {\n if (unlistenHistory) {\n unlistenHistory();\n }\n subscribers.clear();\n pendingNavigationController && pendingNavigationController.abort();\n state.fetchers.forEach((_, key) => deleteFetcher(key));\n state.blockers.forEach((_, key) => deleteBlocker(key));\n }\n // Subscribe to state updates for the router\n function subscribe(fn) {\n subscribers.add(fn);\n return () => subscribers.delete(fn);\n }\n // Update our state and notify the calling context of the change\n function updateState(newState) {\n state = _extends({}, state, newState);\n subscribers.forEach(subscriber => subscriber(state));\n }\n // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION\n // and setting state.[historyAction/location/matches] to the new route.\n // - Location is a required param\n // - Navigation will always be set to IDLE_NAVIGATION\n // - Can pass any other state in newState\n function completeNavigation(location, newState) {\n var _location$state, _location$state2;\n // Deduce if we're in a loading/actionReload state:\n // - We have committed actionData in the store\n // - The current navigation was a mutation submission\n // - We're past the submitting state and into the loading state\n // - The location being loaded is not the result of a redirect\n let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === \"loading\" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true;\n let actionData;\n if (newState.actionData) {\n if (Object.keys(newState.actionData).length > 0) {\n actionData = newState.actionData;\n } else {\n // Empty actionData -> clear prior actionData due to an action error\n actionData = null;\n }\n } else if (isActionReload) {\n // Keep the current data if we're wrapping up the action reload\n actionData = state.actionData;\n } else {\n // Clear actionData on any other completed navigations\n actionData = null;\n }\n // Always preserve any existing loaderData from re-used routes\n let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;\n // On a successful navigation we can assume we got through all blockers\n // so we can start fresh\n let blockers = state.blockers;\n if (blockers.size > 0) {\n blockers = new Map(blockers);\n blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));\n }\n // Always respect the user flag. Otherwise don't reset on mutation\n // submission navigations unless they redirect\n let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true;\n if (inFlightDataRoutes) {\n dataRoutes = inFlightDataRoutes;\n inFlightDataRoutes = undefined;\n }\n if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) {\n init.history.push(location, location.state);\n } else if (pendingAction === Action.Replace) {\n init.history.replace(location, location.state);\n }\n updateState(_extends({}, newState, {\n actionData,\n loaderData,\n historyAction: pendingAction,\n location,\n initialized: true,\n navigation: IDLE_NAVIGATION,\n revalidation: \"idle\",\n restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches),\n preventScrollReset,\n blockers\n }));\n // Reset stateful navigation vars\n pendingAction = Action.Pop;\n pendingPreventScrollReset = false;\n isUninterruptedRevalidation = false;\n isRevalidationRequired = false;\n cancelledDeferredRoutes = [];\n cancelledFetcherLoads = [];\n }\n // Trigger a navigation event, which can either be a numerical POP or a PUSH\n // replace with an optional submission\n async function navigate(to, opts) {\n if (typeof to === \"number\") {\n init.history.go(to);\n return;\n }\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative);\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts);\n let currentLocation = state.location;\n let nextLocation = createLocation(state.location, path, opts && opts.state);\n // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded\n // URL from window.location, so we need to encode it here so the behavior\n // remains the same as POP and non-data-router usages. new URL() does all\n // the same encoding we'd get from a history.pushState/window.location read\n // without having to touch history\n nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation));\n let userReplace = opts && opts.replace != null ? opts.replace : undefined;\n let historyAction = Action.Push;\n if (userReplace === true) {\n historyAction = Action.Replace;\n } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) {\n // By default on submissions to the current location we REPLACE so that\n // users don't have to double-click the back button to get to the prior\n // location. If the user redirects to a different location from the\n // action/loader this will be ignored and the redirect will be a PUSH\n historyAction = Action.Replace;\n }\n let preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : undefined;\n let blockerKey = shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction\n });\n if (blockerKey) {\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location: nextLocation,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location: nextLocation\n });\n // Send the same navigation through\n navigate(to, opts);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return await startNavigation(historyAction, nextLocation, {\n submission,\n // Send through the formData serialization error if we have one so we can\n // render at the right error boundary after we match routes\n pendingError: error,\n preventScrollReset,\n replace: opts && opts.replace\n });\n }\n // Revalidate all current loaders. If a navigation is in progress or if this\n // is interrupted by a navigation, allow this to \"succeed\" by calling all\n // loaders during the next loader round\n function revalidate() {\n interruptActiveLoads();\n updateState({\n revalidation: \"loading\"\n });\n // If we're currently submitting an action, we don't need to start a new\n // navigation, we'll just let the follow up loader execution call all loaders\n if (state.navigation.state === \"submitting\") {\n return;\n }\n // If we're currently in an idle state, start a new navigation for the current\n // action/location and mark it as uninterrupted, which will skip the history\n // update in completeNavigation\n if (state.navigation.state === \"idle\") {\n startNavigation(state.historyAction, state.location, {\n startUninterruptedRevalidation: true\n });\n return;\n }\n // Otherwise, if we're currently in a loading state, just start a new\n // navigation to the navigation.location but do not trigger an uninterrupted\n // revalidation so that history correctly updates once the navigation completes\n startNavigation(pendingAction || state.historyAction, state.navigation.location, {\n overrideNavigation: state.navigation\n });\n }\n // Start a navigation to the given action/location. Can optionally provide a\n // overrideNavigation which will override the normalLoad in the case of a redirect\n // navigation\n async function startNavigation(historyAction, location, opts) {\n // Abort any in-progress navigations and start a new one. Unset any ongoing\n // uninterrupted revalidations unless told otherwise, since we want this\n // new navigation to update history normally\n pendingNavigationController && pendingNavigationController.abort();\n pendingNavigationController = null;\n pendingAction = historyAction;\n isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;\n // Save the current scroll position every time we start a new navigation,\n // and track whether we should reset scroll on completion\n saveScrollPosition(state.location, state.matches);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let loadingNavigation = opts && opts.overrideNavigation;\n let matches = matchRoutes(routesToUse, location, basename);\n // Short circuit with a 404 on the root error boundary if we match nothing\n if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(routesToUse);\n // Cancel all pending deferred on 404s since we don't keep any routes\n cancelActiveDeferreds();\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n });\n return;\n }\n // Short circuit if it's only a hash change and not a revalidation or\n // mutation submission.\n //\n // Ignore on initial page loads because since the initial load will always\n // be \"same hash\". For example, on /page#hash and submit a
\n // which will default to a navigation to /page\n if (state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {\n completeNavigation(location, {\n matches\n });\n return;\n }\n // Create a controller/Request for this navigation\n pendingNavigationController = new AbortController();\n let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);\n let pendingActionData;\n let pendingError;\n if (opts && opts.pendingError) {\n // If we have a pendingError, it means the user attempted a GET submission\n // with binary FormData so assign here and skip to handleLoaders. That\n // way we handle calling loaders above the boundary etc. It's not really\n // different from an actionError in that sense.\n pendingError = {\n [findNearestBoundary(matches).route.id]: opts.pendingError\n };\n } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {\n // Call action if we received an action submission\n let actionOutput = await handleAction(request, location, opts.submission, matches, {\n replace: opts.replace\n });\n if (actionOutput.shortCircuited) {\n return;\n }\n pendingActionData = actionOutput.pendingActionData;\n pendingError = actionOutput.pendingActionError;\n loadingNavigation = getLoadingNavigation(location, opts.submission);\n // Create a GET request for the loaders\n request = new Request(request.url, {\n signal: request.signal\n });\n }\n // Call loaders\n let {\n shortCircuited,\n loaderData,\n errors\n } = await handleLoaders(request, location, matches, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, pendingActionData, pendingError);\n if (shortCircuited) {\n return;\n }\n // Clean up now that the action/loaders have completed. Don't clean up if\n // we short circuited because pendingNavigationController will have already\n // been assigned to a new controller for the next navigation\n pendingNavigationController = null;\n completeNavigation(location, _extends({\n matches\n }, pendingActionData ? {\n actionData: pendingActionData\n } : {}, {\n loaderData,\n errors\n }));\n }\n // Call the action matched by the leaf route for this navigation and handle\n // redirects/errors\n async function handleAction(request, location, submission, matches, opts) {\n if (opts === void 0) {\n opts = {};\n }\n interruptActiveLoads();\n // Put us in a submitting state\n let navigation = getSubmittingNavigation(location, submission);\n updateState({\n navigation\n });\n // Call our action and get the result\n let result;\n let actionMatch = getTargetMatch(matches, location);\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n result = {\n type: ResultType.error,\n error: getInternalRouterError(405, {\n method: request.method,\n pathname: location.pathname,\n routeId: actionMatch.route.id\n })\n };\n } else {\n result = await callLoaderOrAction(\"action\", request, actionMatch, matches, manifest, mapRouteProperties, basename);\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n }\n if (isRedirectResult(result)) {\n let replace;\n if (opts && opts.replace != null) {\n replace = opts.replace;\n } else {\n // If the user didn't explicity indicate replace behavior, replace if\n // we redirected to the exact same location we're currently at to avoid\n // double back-buttons\n replace = result.location === state.location.pathname + state.location.search;\n }\n await startRedirectNavigation(state, result, {\n submission,\n replace\n });\n return {\n shortCircuited: true\n };\n }\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n // By default, all submissions are REPLACE navigations, but if the\n // action threw an error that'll be rendered in an errorElement, we fall\n // back to PUSH so that the user can use the back button to get back to\n // the pre-submission form location to try again\n if ((opts && opts.replace) !== true) {\n pendingAction = Action.Push;\n }\n return {\n // Send back an empty object we can use to clear out any prior actionData\n pendingActionData: {},\n pendingActionError: {\n [boundaryMatch.route.id]: result.error\n }\n };\n }\n if (isDeferredResult(result)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n return {\n pendingActionData: {\n [actionMatch.route.id]: result.data\n }\n };\n }\n // Call all applicable loaders for the given matches, handling redirects,\n // errors, etc.\n async function handleLoaders(request, location, matches, overrideNavigation, submission, fetcherSubmission, replace, pendingActionData, pendingError) {\n // Figure out the right navigation we want to use for data loading\n let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);\n // If this was a redirect from an action we don't have a \"submission\" but\n // we have it on the loading navigation so use that if available\n let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError);\n // Cancel pending deferreds for no-longer-matched routes or routes we're\n // about to reload. Note that if this is an action reload we would have\n // already cancelled all pending deferreds so this would be a no-op\n cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId));\n pendingNavigationLoadId = ++incrementingLoadId;\n // Short circuit if we have no loaders to run\n if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {\n let updatedFetchers = markFetchRedirectsDone();\n completeNavigation(location, _extends({\n matches,\n loaderData: {},\n // Commit pending error if we're short circuiting\n errors: pendingError || null\n }, pendingActionData ? {\n actionData: pendingActionData\n } : {}, updatedFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {}));\n return {\n shortCircuited: true\n };\n }\n // If this is an uninterrupted revalidation, we remain in our current idle\n // state. If not, we need to switch to our loading state and load data,\n // preserving any new action data or existing action data (in the case of\n // a revalidation interrupting an actionReload)\n if (!isUninterruptedRevalidation) {\n revalidatingFetchers.forEach(rf => {\n let fetcher = state.fetchers.get(rf.key);\n let revalidatingFetcher = getLoadingFetcher(undefined, fetcher ? fetcher.data : undefined);\n state.fetchers.set(rf.key, revalidatingFetcher);\n });\n let actionData = pendingActionData || state.actionData;\n updateState(_extends({\n navigation: loadingNavigation\n }, actionData ? Object.keys(actionData).length === 0 ? {\n actionData: null\n } : {\n actionData\n } : {}, revalidatingFetchers.length > 0 ? {\n fetchers: new Map(state.fetchers)\n } : {}));\n }\n revalidatingFetchers.forEach(rf => {\n if (fetchControllers.has(rf.key)) {\n abortFetcher(rf.key);\n }\n if (rf.controller) {\n // Fetchers use an independent AbortController so that aborting a fetcher\n // (via deleteFetcher) does not abort the triggering navigation that\n // triggered the revalidation\n fetchControllers.set(rf.key, rf.controller);\n }\n });\n // Proxy navigation abort through to revalidation fetchers\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(f => abortFetcher(f.key));\n if (pendingNavigationController) {\n pendingNavigationController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n let {\n results,\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, request);\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n // Clean up _after_ loaders have completed. Don't clean up if we short\n // circuited because fetchControllers would have been aborted and\n // reassigned to new controllers for the next navigation\n if (pendingNavigationController) {\n pendingNavigationController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n revalidatingFetchers.forEach(rf => fetchControllers.delete(rf.key));\n // If any loaders returned a redirect Response, start a new REPLACE navigation\n let redirect = findRedirect(results);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n await startRedirectNavigation(state, redirect.result, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, matchesToLoad, loaderResults, pendingError, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Wire up subscribers to update loaderData as promises settle\n activeDeferreds.forEach((deferredData, routeId) => {\n deferredData.subscribe(aborted => {\n // Note: No need to updateState here since the TrackedPromise on\n // loaderData is stable across resolve/reject\n // Remove this instance if we were aborted or if promises have settled\n if (aborted || deferredData.done) {\n activeDeferreds.delete(routeId);\n }\n });\n });\n let updatedFetchers = markFetchRedirectsDone();\n let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);\n let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;\n return _extends({\n loaderData,\n errors\n }, shouldUpdateFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {});\n }\n function getFetcher(key) {\n return state.fetchers.get(key) || IDLE_FETCHER;\n }\n // Trigger a fetcher load/submit for the given fetcher key\n function fetch(key, routeId, href, opts) {\n if (isServer) {\n throw new Error(\"router.fetch() was called during the server render, but it shouldn't be. \" + \"You are likely calling a useFetcher() method in the body of your component. \" + \"Try moving it to a useEffect or a callback.\");\n }\n if (fetchControllers.has(key)) abortFetcher(key);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, routeId, opts == null ? void 0 : opts.relative);\n let matches = matchRoutes(routesToUse, normalizedPath, basename);\n if (!matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: normalizedPath\n }));\n return;\n }\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts);\n if (error) {\n setFetcherError(key, routeId, error);\n return;\n }\n let match = getTargetMatch(matches, path);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, submission);\n return;\n }\n // Store off the match so we can call it's shouldRevalidate on subsequent\n // revalidations\n fetchLoadMatches.set(key, {\n routeId,\n path\n });\n handleFetcherLoader(key, routeId, path, match, matches, submission);\n }\n // Call the action for the matched fetcher.submit(), and then handle redirects,\n // errors, and revalidation\n async function handleFetcherAction(key, routeId, path, match, requestMatches, submission) {\n interruptActiveLoads();\n fetchLoadMatches.delete(key);\n if (!match.route.action && !match.route.lazy) {\n let error = getInternalRouterError(405, {\n method: submission.formMethod,\n pathname: path,\n routeId: routeId\n });\n setFetcherError(key, routeId, error);\n return;\n }\n // Put this fetcher into it's submitting state\n let existingFetcher = state.fetchers.get(key);\n let fetcher = getSubmittingFetcher(submission, existingFetcher);\n state.fetchers.set(key, fetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\n // Call the action for the fetcher\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let actionResult = await callLoaderOrAction(\"action\", fetchRequest, match, requestMatches, manifest, mapRouteProperties, basename);\n if (fetchRequest.signal.aborted) {\n // We can delete this so long as we weren't aborted by ou our own fetcher\n // re-submit which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n return;\n }\n if (isRedirectResult(actionResult)) {\n fetchControllers.delete(key);\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our action started, so that\n // should take precedence over this redirect navigation. We already\n // set isRevalidationRequired so all loaders for the new route should\n // fire unless opted out via shouldRevalidate\n let doneFetcher = getDoneFetcher(undefined);\n state.fetchers.set(key, doneFetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\n return;\n } else {\n fetchRedirectIds.add(key);\n let loadingFetcher = getLoadingFetcher(submission);\n state.fetchers.set(key, loadingFetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\n return startRedirectNavigation(state, actionResult, {\n submission,\n isFetchActionRedirect: true\n });\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(actionResult)) {\n setFetcherError(key, routeId, actionResult.error);\n return;\n }\n if (isDeferredResult(actionResult)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n // Start the data load for current matches, or the next location if we're\n // in the middle of a navigation\n let nextLocation = state.navigation.location || state.location;\n let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let matches = state.navigation.state !== \"idle\" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;\n invariant(matches, \"Didn't find any matches after fetcher action\");\n let loadId = ++incrementingLoadId;\n fetchReloadIds.set(key, loadId);\n let loadFetcher = getLoadingFetcher(submission, actionResult.data);\n state.fetchers.set(key, loadFetcher);\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, {\n [match.route.id]: actionResult.data\n }, undefined // No need to send through errors since we short circuit above\n );\n // Put all revalidating fetchers into the loading state, except for the\n // current fetcher which we want to keep in it's current loading state which\n // contains it's action submission info + action data\n revalidatingFetchers.filter(rf => rf.key !== key).forEach(rf => {\n let staleKey = rf.key;\n let existingFetcher = state.fetchers.get(staleKey);\n let revalidatingFetcher = getLoadingFetcher(undefined, existingFetcher ? existingFetcher.data : undefined);\n state.fetchers.set(staleKey, revalidatingFetcher);\n if (fetchControllers.has(staleKey)) {\n abortFetcher(staleKey);\n }\n if (rf.controller) {\n fetchControllers.set(staleKey, rf.controller);\n }\n });\n updateState({\n fetchers: new Map(state.fetchers)\n });\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(rf => abortFetcher(rf.key));\n abortController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n let {\n results,\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, revalidationRequest);\n if (abortController.signal.aborted) {\n return;\n }\n abortController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n fetchReloadIds.delete(key);\n fetchControllers.delete(key);\n revalidatingFetchers.forEach(r => fetchControllers.delete(r.key));\n let redirect = findRedirect(results);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n return startRedirectNavigation(state, redirect.result);\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, state.matches, matchesToLoad, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Since we let revalidations complete even if the submitting fetcher was\n // deleted, only put it back to idle if it hasn't been deleted\n if (state.fetchers.has(key)) {\n let doneFetcher = getDoneFetcher(actionResult.data);\n state.fetchers.set(key, doneFetcher);\n }\n let didAbortFetchLoads = abortStaleFetchLoads(loadId);\n // If we are currently in a navigation loading state and this fetcher is\n // more recent than the navigation, we want the newer data so abort the\n // navigation and complete it with the fetcher data\n if (state.navigation.state === \"loading\" && loadId > pendingNavigationLoadId) {\n invariant(pendingAction, \"Expected pending action\");\n pendingNavigationController && pendingNavigationController.abort();\n completeNavigation(state.navigation.location, {\n matches,\n loaderData,\n errors,\n fetchers: new Map(state.fetchers)\n });\n } else {\n // otherwise just update with the fetcher data, preserving any existing\n // loaderData for loaders that did not need to reload. We have to\n // manually merge here since we aren't going through completeNavigation\n updateState(_extends({\n errors,\n loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors)\n }, didAbortFetchLoads || revalidatingFetchers.length > 0 ? {\n fetchers: new Map(state.fetchers)\n } : {}));\n isRevalidationRequired = false;\n }\n }\n // Call the matched loader for fetcher.load(), handling redirects, errors, etc.\n async function handleFetcherLoader(key, routeId, path, match, matches, submission) {\n let existingFetcher = state.fetchers.get(key);\n // Put this fetcher into it's loading state\n let loadingFetcher = getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : undefined);\n state.fetchers.set(key, loadingFetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\n // Call the loader for this fetcher route match\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let result = await callLoaderOrAction(\"loader\", fetchRequest, match, matches, manifest, mapRouteProperties, basename);\n // Deferred isn't supported for fetcher loads, await everything and treat it\n // as a normal load. resolveDeferredData will return undefined if this\n // fetcher gets aborted, so we just leave result untouched and short circuit\n // below if that happens\n if (isDeferredResult(result)) {\n result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result;\n }\n // We can delete this so long as we weren't aborted by our our own fetcher\n // re-load which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n if (fetchRequest.signal.aborted) {\n return;\n }\n // If the loader threw a redirect Response, start a new REPLACE navigation\n if (isRedirectResult(result)) {\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our loader started, so that\n // should take precedence over this redirect navigation\n let doneFetcher = getDoneFetcher(undefined);\n state.fetchers.set(key, doneFetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\n return;\n } else {\n fetchRedirectIds.add(key);\n await startRedirectNavigation(state, result);\n return;\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n state.fetchers.delete(key);\n // TODO: In remix, this would reset to IDLE_NAVIGATION if it was a catch -\n // do we need to behave any differently with our non-redirect errors?\n // What if it was a non-redirect Response?\n updateState({\n fetchers: new Map(state.fetchers),\n errors: {\n [boundaryMatch.route.id]: result.error\n }\n });\n return;\n }\n invariant(!isDeferredResult(result), \"Unhandled fetcher deferred data\");\n // Put the fetcher back into an idle state\n let doneFetcher = getDoneFetcher(result.data);\n state.fetchers.set(key, doneFetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\n }\n /**\n * Utility function to handle redirects returned from an action or loader.\n * Normally, a redirect \"replaces\" the navigation that triggered it. So, for\n * example:\n *\n * - user is on /a\n * - user clicks a link to /b\n * - loader for /b redirects to /c\n *\n * In a non-JS app the browser would track the in-flight navigation to /b and\n * then replace it with /c when it encountered the redirect response. In\n * the end it would only ever update the URL bar with /c.\n *\n * In client-side routing using pushState/replaceState, we aim to emulate\n * this behavior and we also do not update history until the end of the\n * navigation (including processed redirects). This means that we never\n * actually touch history until we've processed redirects, so we just use\n * the history action from the original navigation (PUSH or REPLACE).\n */\n async function startRedirectNavigation(state, redirect, _temp) {\n let {\n submission,\n replace,\n isFetchActionRedirect\n } = _temp === void 0 ? {} : _temp;\n if (redirect.revalidate) {\n isRevalidationRequired = true;\n }\n let redirectLocation = createLocation(state.location, redirect.location, // TODO: This can be removed once we get rid of useTransition in Remix v2\n _extends({\n _isRedirect: true\n }, isFetchActionRedirect ? {\n _isFetchActionRedirect: true\n } : {}));\n invariant(redirectLocation, \"Expected a location on the redirect navigation\");\n if (isBrowser) {\n let isDocumentReload = false;\n if (redirect.reloadDocument) {\n // Hard reload if the response contained X-Remix-Reload-Document\n isDocumentReload = true;\n } else if (ABSOLUTE_URL_REGEX.test(redirect.location)) {\n const url = init.history.createURL(redirect.location);\n isDocumentReload =\n // Hard reload if it's an absolute URL to a new origin\n url.origin !== routerWindow.location.origin ||\n // Hard reload if it's an absolute URL that does not match our basename\n stripBasename(url.pathname, basename) == null;\n }\n if (isDocumentReload) {\n if (replace) {\n routerWindow.location.replace(redirect.location);\n } else {\n routerWindow.location.assign(redirect.location);\n }\n return;\n }\n }\n // There's no need to abort on redirects, since we don't detect the\n // redirect until the action/loaders have settled\n pendingNavigationController = null;\n let redirectHistoryAction = replace === true ? Action.Replace : Action.Push;\n // Use the incoming submission if provided, fallback on the active one in\n // state.navigation\n let activeSubmission = submission || getSubmissionFromNavigation(state.navigation);\n // If this was a 307/308 submission we want to preserve the HTTP method and\n // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the\n // redirected location\n if (redirectPreserveMethodStatusCodes.has(redirect.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) {\n await startNavigation(redirectHistoryAction, redirectLocation, {\n submission: _extends({}, activeSubmission, {\n formAction: redirect.location\n }),\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n } else if (isFetchActionRedirect) {\n // For a fetch action redirect, we kick off a new loading navigation\n // without the fetcher submission, but we send it along for shouldRevalidate\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation: getLoadingNavigation(redirectLocation),\n fetcherSubmission: activeSubmission,\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n } else {\n // If we have a submission, we will preserve it through the redirect navigation\n let overrideNavigation = getLoadingNavigation(redirectLocation, activeSubmission);\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation,\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n }\n }\n async function callLoadersAndMaybeResolveData(currentMatches, matches, matchesToLoad, fetchersToLoad, request) {\n // Call all navigation loaders and revalidating fetcher loaders in parallel,\n // then slice off the results into separate arrays so we can handle them\n // accordingly\n let results = await Promise.all([...matchesToLoad.map(match => callLoaderOrAction(\"loader\", request, match, matches, manifest, mapRouteProperties, basename)), ...fetchersToLoad.map(f => {\n if (f.matches && f.match && f.controller) {\n return callLoaderOrAction(\"loader\", createClientSideRequest(init.history, f.path, f.controller.signal), f.match, f.matches, manifest, mapRouteProperties, basename);\n } else {\n let error = {\n type: ResultType.error,\n error: getInternalRouterError(404, {\n pathname: f.path\n })\n };\n return error;\n }\n })]);\n let loaderResults = results.slice(0, matchesToLoad.length);\n let fetcherResults = results.slice(matchesToLoad.length);\n await Promise.all([resolveDeferredResults(currentMatches, matchesToLoad, loaderResults, loaderResults.map(() => request.signal), false, state.loaderData), resolveDeferredResults(currentMatches, fetchersToLoad.map(f => f.match), fetcherResults, fetchersToLoad.map(f => f.controller ? f.controller.signal : null), true)]);\n return {\n results,\n loaderResults,\n fetcherResults\n };\n }\n function interruptActiveLoads() {\n // Every interruption triggers a revalidation\n isRevalidationRequired = true;\n // Cancel pending route-level deferreds and mark cancelled routes for\n // revalidation\n cancelledDeferredRoutes.push(...cancelActiveDeferreds());\n // Abort in-flight fetcher loads\n fetchLoadMatches.forEach((_, key) => {\n if (fetchControllers.has(key)) {\n cancelledFetcherLoads.push(key);\n abortFetcher(key);\n }\n });\n }\n function setFetcherError(key, routeId, error) {\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n deleteFetcher(key);\n updateState({\n errors: {\n [boundaryMatch.route.id]: error\n },\n fetchers: new Map(state.fetchers)\n });\n }\n function deleteFetcher(key) {\n let fetcher = state.fetchers.get(key);\n // Don't abort the controller if this is a deletion of a fetcher.submit()\n // in it's loading phase since - we don't want to abort the corresponding\n // revalidation and want them to complete and land\n if (fetchControllers.has(key) && !(fetcher && fetcher.state === \"loading\" && fetchReloadIds.has(key))) {\n abortFetcher(key);\n }\n fetchLoadMatches.delete(key);\n fetchReloadIds.delete(key);\n fetchRedirectIds.delete(key);\n state.fetchers.delete(key);\n }\n function abortFetcher(key) {\n let controller = fetchControllers.get(key);\n invariant(controller, \"Expected fetch controller: \" + key);\n controller.abort();\n fetchControllers.delete(key);\n }\n function markFetchersDone(keys) {\n for (let key of keys) {\n let fetcher = getFetcher(key);\n let doneFetcher = getDoneFetcher(fetcher.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n function markFetchRedirectsDone() {\n let doneKeys = [];\n let updatedFetchers = false;\n for (let key of fetchRedirectIds) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n fetchRedirectIds.delete(key);\n doneKeys.push(key);\n updatedFetchers = true;\n }\n }\n markFetchersDone(doneKeys);\n return updatedFetchers;\n }\n function abortStaleFetchLoads(landedId) {\n let yeetedKeys = [];\n for (let [key, id] of fetchReloadIds) {\n if (id < landedId) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n abortFetcher(key);\n fetchReloadIds.delete(key);\n yeetedKeys.push(key);\n }\n }\n }\n markFetchersDone(yeetedKeys);\n return yeetedKeys.length > 0;\n }\n function getBlocker(key, fn) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n if (blockerFunctions.get(key) !== fn) {\n blockerFunctions.set(key, fn);\n }\n return blocker;\n }\n function deleteBlocker(key) {\n state.blockers.delete(key);\n blockerFunctions.delete(key);\n }\n // Utility function to update blockers, ensuring valid state transitions\n function updateBlocker(key, newBlocker) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n // Poor mans state machine :)\n // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM\n invariant(blocker.state === \"unblocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"proceeding\" || blocker.state === \"blocked\" && newBlocker.state === \"unblocked\" || blocker.state === \"proceeding\" && newBlocker.state === \"unblocked\", \"Invalid blocker state transition: \" + blocker.state + \" -> \" + newBlocker.state);\n let blockers = new Map(state.blockers);\n blockers.set(key, newBlocker);\n updateState({\n blockers\n });\n }\n function shouldBlockNavigation(_ref2) {\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = _ref2;\n if (blockerFunctions.size === 0) {\n return;\n }\n // We ony support a single active blocker at the moment since we don't have\n // any compelling use cases for multi-blocker yet\n if (blockerFunctions.size > 1) {\n warning(false, \"A router only supports one blocker at a time\");\n }\n let entries = Array.from(blockerFunctions.entries());\n let [blockerKey, blockerFunction] = entries[entries.length - 1];\n let blocker = state.blockers.get(blockerKey);\n if (blocker && blocker.state === \"proceeding\") {\n // If the blocker is currently proceeding, we don't need to re-check\n // it and can let this navigation continue\n return;\n }\n // At this point, we know we're unblocked/blocked so we need to check the\n // user-provided blocker function\n if (blockerFunction({\n currentLocation,\n nextLocation,\n historyAction\n })) {\n return blockerKey;\n }\n }\n function cancelActiveDeferreds(predicate) {\n let cancelledRouteIds = [];\n activeDeferreds.forEach((dfd, routeId) => {\n if (!predicate || predicate(routeId)) {\n // Cancel the deferred - but do not remove from activeDeferreds here -\n // we rely on the subscribers to do that so our tests can assert proper\n // cleanup via _internalActiveDeferreds\n dfd.cancel();\n cancelledRouteIds.push(routeId);\n activeDeferreds.delete(routeId);\n }\n });\n return cancelledRouteIds;\n }\n // Opt in to capturing and reporting scroll positions during navigations,\n // used by the component\n function enableScrollRestoration(positions, getPosition, getKey) {\n savedScrollPositions = positions;\n getScrollPosition = getPosition;\n getScrollRestorationKey = getKey || null;\n // Perform initial hydration scroll restoration, since we miss the boat on\n // the initial updateState() because we've not yet rendered \n // and therefore have no savedScrollPositions available\n if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n initialScrollRestored = true;\n let y = getSavedScrollPosition(state.location, state.matches);\n if (y != null) {\n updateState({\n restoreScrollPosition: y\n });\n }\n }\n return () => {\n savedScrollPositions = null;\n getScrollPosition = null;\n getScrollRestorationKey = null;\n };\n }\n function getScrollKey(location, matches) {\n if (getScrollRestorationKey) {\n let key = getScrollRestorationKey(location, matches.map(m => createUseMatchesMatch(m, state.loaderData)));\n return key || location.key;\n }\n return location.key;\n }\n function saveScrollPosition(location, matches) {\n if (savedScrollPositions && getScrollPosition) {\n let key = getScrollKey(location, matches);\n savedScrollPositions[key] = getScrollPosition();\n }\n }\n function getSavedScrollPosition(location, matches) {\n if (savedScrollPositions) {\n let key = getScrollKey(location, matches);\n let y = savedScrollPositions[key];\n if (typeof y === \"number\") {\n return y;\n }\n }\n return null;\n }\n function _internalSetRoutes(newRoutes) {\n manifest = {};\n inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest);\n }\n router = {\n get basename() {\n return basename;\n },\n get state() {\n return state;\n },\n get routes() {\n return dataRoutes;\n },\n initialize,\n subscribe,\n enableScrollRestoration,\n navigate,\n fetch,\n revalidate,\n // Passthrough to history-aware createHref used by useHref so we get proper\n // hash-aware URLs in DOM paths\n createHref: to => init.history.createHref(to),\n encodeLocation: to => init.history.encodeLocation(to),\n getFetcher,\n deleteFetcher,\n dispose,\n getBlocker,\n deleteBlocker,\n _internalFetchControllers: fetchControllers,\n _internalActiveDeferreds: activeDeferreds,\n // TODO: Remove setRoutes, it's temporary to avoid dealing with\n // updating the tree while validating the update algorithm.\n _internalSetRoutes\n };\n return router;\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createStaticHandler\n////////////////////////////////////////////////////////////////////////////////\nconst UNSAFE_DEFERRED_SYMBOL = Symbol(\"deferred\");\nfunction createStaticHandler(routes, opts) {\n invariant(routes.length > 0, \"You must provide a non-empty routes array to createStaticHandler\");\n let manifest = {};\n let basename = (opts ? opts.basename : null) || \"/\";\n let mapRouteProperties;\n if (opts != null && opts.mapRouteProperties) {\n mapRouteProperties = opts.mapRouteProperties;\n } else if (opts != null && opts.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = opts.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);\n /**\n * The query() method is intended for document requests, in which we want to\n * call an optional action and potentially multiple loaders for all nested\n * routes. It returns a StaticHandlerContext object, which is very similar\n * to the router state (location, loaderData, actionData, errors, etc.) and\n * also adds SSR-specific information such as the statusCode and headers\n * from action/loaders Responses.\n *\n * It _should_ never throw and should report all errors through the\n * returned context.errors object, properly associating errors to their error\n * boundary. Additionally, it tracks _deepestRenderedBoundaryId which can be\n * used to emulate React error boundaries during SSr by performing a second\n * pass only down to the boundaryId.\n *\n * The one exception where we do not return a StaticHandlerContext is when a\n * redirect response is returned or thrown from any action/loader. We\n * propagate that out and return the raw Response so the HTTP server can\n * return it directly.\n */\n async function query(request, _temp2) {\n let {\n requestContext\n } = _temp2 === void 0 ? {} : _temp2;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\") {\n let error = getInternalRouterError(405, {\n method\n });\n let {\n matches: methodNotAllowedMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: methodNotAllowedMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n } else if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: notFoundMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n let result = await queryImpl(request, location, matches, requestContext);\n if (isResponse(result)) {\n return result;\n }\n // When returning StaticHandlerContext, we patch back in the location here\n // since we need it for React Context. But this helps keep our submit and\n // loadRouteData operating on a Request instead of a Location\n return _extends({\n location,\n basename\n }, result);\n }\n /**\n * The queryRoute() method is intended for targeted route requests, either\n * for fetch ?_data requests or resource route requests. In this case, we\n * are only ever calling a single action or loader, and we are returning the\n * returned value directly. In most cases, this will be a Response returned\n * from the action/loader, but it may be a primitive or other value as well -\n * and in such cases the calling context should handle that accordingly.\n *\n * We do respect the throw/return differentiation, so if an action/loader\n * throws, then this method will throw the value. This is important so we\n * can do proper boundary identification in Remix where a thrown Response\n * must go to the Catch Boundary but a returned Response is happy-path.\n *\n * One thing to note is that any Router-initiated Errors that make sense\n * to associate with a status code will be thrown as an ErrorResponse\n * instance which include the raw Error, such that the calling context can\n * serialize the error as they see fit while including the proper response\n * code. Examples here are 404 and 405 errors that occur prior to reaching\n * any user-defined loaders.\n */\n async function queryRoute(request, _temp3) {\n let {\n routeId,\n requestContext\n } = _temp3 === void 0 ? {} : _temp3;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\" && method !== \"OPTIONS\") {\n throw getInternalRouterError(405, {\n method\n });\n } else if (!matches) {\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let match = routeId ? matches.find(m => m.route.id === routeId) : getTargetMatch(matches, location);\n if (routeId && !match) {\n throw getInternalRouterError(403, {\n pathname: location.pathname,\n routeId\n });\n } else if (!match) {\n // This should never hit I don't think?\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let result = await queryImpl(request, location, matches, requestContext, match);\n if (isResponse(result)) {\n return result;\n }\n let error = result.errors ? Object.values(result.errors)[0] : undefined;\n if (error !== undefined) {\n // If we got back result.errors, that means the loader/action threw\n // _something_ that wasn't a Response, but it's not guaranteed/required\n // to be an `instanceof Error` either, so we have to use throw here to\n // preserve the \"error\" state outside of queryImpl.\n throw error;\n }\n // Pick off the right state value to return\n if (result.actionData) {\n return Object.values(result.actionData)[0];\n }\n if (result.loaderData) {\n var _result$activeDeferre;\n let data = Object.values(result.loaderData)[0];\n if ((_result$activeDeferre = result.activeDeferreds) != null && _result$activeDeferre[match.route.id]) {\n data[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id];\n }\n return data;\n }\n return undefined;\n }\n async function queryImpl(request, location, matches, requestContext, routeMatch) {\n invariant(request.signal, \"query()/queryRoute() requests must contain an AbortController signal\");\n try {\n if (isMutationMethod(request.method.toLowerCase())) {\n let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, routeMatch != null);\n return result;\n }\n let result = await loadRouteData(request, matches, requestContext, routeMatch);\n return isResponse(result) ? result : _extends({}, result, {\n actionData: null,\n actionHeaders: {}\n });\n } catch (e) {\n // If the user threw/returned a Response in callLoaderOrAction, we throw\n // it to bail out and then return or throw here based on whether the user\n // returned or threw\n if (isQueryRouteResponse(e)) {\n if (e.type === ResultType.error) {\n throw e.response;\n }\n return e.response;\n }\n // Redirects are always returned since they don't propagate to catch\n // boundaries\n if (isRedirectResponse(e)) {\n return e;\n }\n throw e;\n }\n }\n async function submit(request, matches, actionMatch, requestContext, isRouteRequest) {\n let result;\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n let error = getInternalRouterError(405, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: actionMatch.route.id\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n } else {\n result = await callLoaderOrAction(\"action\", request, actionMatch, matches, manifest, mapRouteProperties, basename, {\n isStaticRequest: true,\n isRouteRequest,\n requestContext\n });\n if (request.signal.aborted) {\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted\");\n }\n }\n if (isRedirectResult(result)) {\n // Uhhhh - this should never happen, we should always throw these from\n // callLoaderOrAction, but the type narrowing here keeps TS happy and we\n // can get back on the \"throw all redirect responses\" train here should\n // this ever happen :/\n throw new Response(null, {\n status: result.status,\n headers: {\n Location: result.location\n }\n });\n }\n if (isDeferredResult(result)) {\n let error = getInternalRouterError(400, {\n type: \"defer-action\"\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n }\n if (isRouteRequest) {\n // Note: This should only be non-Response values if we get here, since\n // isRouteRequest should throw any Response received in callLoaderOrAction\n if (isErrorResult(result)) {\n throw result.error;\n }\n return {\n matches: [actionMatch],\n loaderData: {},\n actionData: {\n [actionMatch.route.id]: result.data\n },\n errors: null,\n // Note: statusCode + headers are unused here since queryRoute will\n // return the raw Response or value\n statusCode: 200,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n let context = await loadRouteData(request, matches, requestContext, undefined, {\n [boundaryMatch.route.id]: result.error\n });\n // action status codes take precedence over loader status codes\n return _extends({}, context, {\n statusCode: isRouteErrorResponse(result.error) ? result.error.status : 500,\n actionData: null,\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n // Create a GET request for the loaders\n let loaderRequest = new Request(request.url, {\n headers: request.headers,\n redirect: request.redirect,\n signal: request.signal\n });\n let context = await loadRouteData(loaderRequest, matches, requestContext);\n return _extends({}, context, result.statusCode ? {\n statusCode: result.statusCode\n } : {}, {\n actionData: {\n [actionMatch.route.id]: result.data\n },\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n async function loadRouteData(request, matches, requestContext, routeMatch, pendingActionError) {\n let isRouteRequest = routeMatch != null;\n // Short circuit if we have no loaders to run (queryRoute())\n if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader) && !(routeMatch != null && routeMatch.route.lazy)) {\n throw getInternalRouterError(400, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: routeMatch == null ? void 0 : routeMatch.route.id\n });\n }\n let requestMatches = routeMatch ? [routeMatch] : getLoaderMatchesUntilBoundary(matches, Object.keys(pendingActionError || {})[0]);\n let matchesToLoad = requestMatches.filter(m => m.route.loader || m.route.lazy);\n // Short circuit if we have no loaders to run (query())\n if (matchesToLoad.length === 0) {\n return {\n matches,\n // Add a null for all matched routes for proper revalidation on the client\n loaderData: matches.reduce((acc, m) => Object.assign(acc, {\n [m.route.id]: null\n }), {}),\n errors: pendingActionError || null,\n statusCode: 200,\n loaderHeaders: {},\n activeDeferreds: null\n };\n }\n let results = await Promise.all([...matchesToLoad.map(match => callLoaderOrAction(\"loader\", request, match, matches, manifest, mapRouteProperties, basename, {\n isStaticRequest: true,\n isRouteRequest,\n requestContext\n }))]);\n if (request.signal.aborted) {\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted\");\n }\n // Process and commit output from loaders\n let activeDeferreds = new Map();\n let context = processRouteLoaderData(matches, matchesToLoad, results, pendingActionError, activeDeferreds);\n // Add a null for any non-loader matches for proper revalidation on the client\n let executedLoaders = new Set(matchesToLoad.map(match => match.route.id));\n matches.forEach(match => {\n if (!executedLoaders.has(match.route.id)) {\n context.loaderData[match.route.id] = null;\n }\n });\n return _extends({}, context, {\n matches,\n activeDeferreds: activeDeferreds.size > 0 ? Object.fromEntries(activeDeferreds.entries()) : null\n });\n }\n return {\n dataRoutes,\n query,\n queryRoute\n };\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Helpers\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Given an existing StaticHandlerContext and an error thrown at render time,\n * provide an updated StaticHandlerContext suitable for a second SSR render\n */\nfunction getStaticContextFromError(routes, context, error) {\n let newContext = _extends({}, context, {\n statusCode: 500,\n errors: {\n [context._deepestRenderedBoundaryId || routes[0].id]: error\n }\n });\n return newContext;\n}\nfunction isSubmissionNavigation(opts) {\n return opts != null && (\"formData\" in opts && opts.formData != null || \"body\" in opts && opts.body !== undefined);\n}\nfunction normalizeTo(location, matches, basename, prependBasename, to, fromRouteId, relative) {\n let contextualMatches;\n let activeRouteMatch;\n if (fromRouteId != null && relative !== \"path\") {\n // Grab matches up to the calling route so our route-relative logic is\n // relative to the correct source route. When using relative:path,\n // fromRouteId is ignored since that is always relative to the current\n // location path\n contextualMatches = [];\n for (let match of matches) {\n contextualMatches.push(match);\n if (match.route.id === fromRouteId) {\n activeRouteMatch = match;\n break;\n }\n }\n } else {\n contextualMatches = matches;\n activeRouteMatch = matches[matches.length - 1];\n }\n // Resolve the relative path\n let path = resolveTo(to ? to : \".\", getPathContributingMatches(contextualMatches).map(m => m.pathnameBase), stripBasename(location.pathname, basename) || location.pathname, relative === \"path\");\n // When `to` is not specified we inherit search/hash from the current\n // location, unlike when to=\".\" and we just inherit the path.\n // See https://github.com/remix-run/remix/issues/927\n if (to == null) {\n path.search = location.search;\n path.hash = location.hash;\n }\n // Add an ?index param for matched index routes if we don't already have one\n if ((to == null || to === \"\" || to === \".\") && activeRouteMatch && activeRouteMatch.route.index && !hasNakedIndexQuery(path.search)) {\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n }\n // If we're operating within a basename, prepend it to the pathname. If\n // this is a root navigation, then just use the raw basename which allows\n // the basename to have full control over the presence of a trailing slash\n // on root actions\n if (prependBasename && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n return createPath(path);\n}\n// Normalize navigation options by converting formMethod=GET formData objects to\n// URLSearchParams so they behave identically to links with query params\nfunction normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {\n // Return location verbatim on non-submission navigations\n if (!opts || !isSubmissionNavigation(opts)) {\n return {\n path\n };\n }\n if (opts.formMethod && !isValidMethod(opts.formMethod)) {\n return {\n path,\n error: getInternalRouterError(405, {\n method: opts.formMethod\n })\n };\n }\n let getInvalidBodyError = () => ({\n path,\n error: getInternalRouterError(400, {\n type: \"invalid-body\"\n })\n });\n // Create a Submission on non-GET navigations\n let rawFormMethod = opts.formMethod || \"get\";\n let formMethod = normalizeFormMethod ? rawFormMethod.toUpperCase() : rawFormMethod.toLowerCase();\n let formAction = stripHashFromPath(path);\n if (opts.body !== undefined) {\n if (opts.formEncType === \"text/plain\") {\n // text only support POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n let text = typeof opts.body === \"string\" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ?\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data\n Array.from(opts.body.entries()).reduce((acc, _ref3) => {\n let [name, value] = _ref3;\n return \"\" + acc + name + \"=\" + value + \"\\n\";\n }, \"\") : String(opts.body);\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json: undefined,\n text\n }\n };\n } else if (opts.formEncType === \"application/json\") {\n // json only supports POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n try {\n let json = typeof opts.body === \"string\" ? JSON.parse(opts.body) : opts.body;\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json,\n text: undefined\n }\n };\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n }\n invariant(typeof FormData === \"function\", \"FormData is not available in this environment\");\n let searchParams;\n let formData;\n if (opts.formData) {\n searchParams = convertFormDataToSearchParams(opts.formData);\n formData = opts.formData;\n } else if (opts.body instanceof FormData) {\n searchParams = convertFormDataToSearchParams(opts.body);\n formData = opts.body;\n } else if (opts.body instanceof URLSearchParams) {\n searchParams = opts.body;\n formData = convertSearchParamsToFormData(searchParams);\n } else if (opts.body == null) {\n searchParams = new URLSearchParams();\n formData = new FormData();\n } else {\n try {\n searchParams = new URLSearchParams(opts.body);\n formData = convertSearchParamsToFormData(searchParams);\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n let submission = {\n formMethod,\n formAction,\n formEncType: opts && opts.formEncType || \"application/x-www-form-urlencoded\",\n formData,\n json: undefined,\n text: undefined\n };\n if (isMutationMethod(submission.formMethod)) {\n return {\n path,\n submission\n };\n }\n // Flatten submission onto URLSearchParams for GET submissions\n let parsedPath = parsePath(path);\n // On GET navigation submissions we can drop the ?index param from the\n // resulting location since all loaders will run. But fetcher GET submissions\n // only run a single loader so we need to preserve any incoming ?index params\n if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) {\n searchParams.append(\"index\", \"\");\n }\n parsedPath.search = \"?\" + searchParams;\n return {\n path: createPath(parsedPath),\n submission\n };\n}\n// Filter out all routes below any caught error as they aren't going to\n// render so we don't need to load them\nfunction getLoaderMatchesUntilBoundary(matches, boundaryId) {\n let boundaryMatches = matches;\n if (boundaryId) {\n let index = matches.findIndex(m => m.route.id === boundaryId);\n if (index >= 0) {\n boundaryMatches = matches.slice(0, index);\n }\n }\n return boundaryMatches;\n}\nfunction getMatchesToLoad(history, state, matches, submission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError) {\n let actionResult = pendingError ? Object.values(pendingError)[0] : pendingActionData ? Object.values(pendingActionData)[0] : undefined;\n let currentUrl = history.createURL(state.location);\n let nextUrl = history.createURL(location);\n // Pick navigation matches that are net-new or qualify for revalidation\n let boundaryId = pendingError ? Object.keys(pendingError)[0] : undefined;\n let boundaryMatches = getLoaderMatchesUntilBoundary(matches, boundaryId);\n let navigationMatches = boundaryMatches.filter((match, index) => {\n if (match.route.lazy) {\n // We haven't loaded this route yet so we don't know if it's got a loader!\n return true;\n }\n if (match.route.loader == null) {\n return false;\n }\n // Always call the loader on new route instances and pending defer cancellations\n if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some(id => id === match.route.id)) {\n return true;\n }\n // This is the default implementation for when we revalidate. If the route\n // provides it's own implementation, then we give them full control but\n // provide this value so they can leverage it if needed after they check\n // their own specific use cases\n let currentRouteMatch = state.matches[index];\n let nextRouteMatch = match;\n return shouldRevalidateLoader(match, _extends({\n currentUrl,\n currentParams: currentRouteMatch.params,\n nextUrl,\n nextParams: nextRouteMatch.params\n }, submission, {\n actionResult,\n defaultShouldRevalidate:\n // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate\n isRevalidationRequired ||\n // Clicked the same link, resubmitted a GET form\n currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search ||\n // Search params affect all loaders\n currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)\n }));\n });\n // Pick fetcher.loads that need to be revalidated\n let revalidatingFetchers = [];\n fetchLoadMatches.forEach((f, key) => {\n // Don't revalidate if fetcher won't be present in the subsequent render\n if (!matches.some(m => m.route.id === f.routeId)) {\n return;\n }\n let fetcherMatches = matchRoutes(routesToUse, f.path, basename);\n // If the fetcher path no longer matches, push it in with null matches so\n // we can trigger a 404 in callLoadersAndMaybeResolveData. Note this is\n // currently only a use-case for Remix HMR where the route tree can change\n // at runtime and remove a route previously loaded via a fetcher\n if (!fetcherMatches) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: null,\n match: null,\n controller: null\n });\n return;\n }\n // Revalidating fetchers are decoupled from the route matches since they\n // load from a static href. They revalidate based on explicit revalidation\n // (submission, useRevalidator, or X-Remix-Revalidate)\n let fetcher = state.fetchers.get(key);\n let fetcherMatch = getTargetMatch(fetcherMatches, f.path);\n let shouldRevalidate = false;\n if (fetchRedirectIds.has(key)) {\n // Never trigger a revalidation of an actively redirecting fetcher\n shouldRevalidate = false;\n } else if (cancelledFetcherLoads.includes(key)) {\n // Always revalidate if the fetcher was cancelled\n shouldRevalidate = true;\n } else if (fetcher && fetcher.state !== \"idle\" && fetcher.data === undefined) {\n // If the fetcher hasn't ever completed loading yet, then this isn't a\n // revalidation, it would just be a brand new load if an explicit\n // revalidation is required\n shouldRevalidate = isRevalidationRequired;\n } else {\n // Otherwise fall back on any user-defined shouldRevalidate, defaulting\n // to explicit revalidations only\n shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends({\n currentUrl,\n currentParams: state.matches[state.matches.length - 1].params,\n nextUrl,\n nextParams: matches[matches.length - 1].params\n }, submission, {\n actionResult,\n defaultShouldRevalidate: isRevalidationRequired\n }));\n }\n if (shouldRevalidate) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: fetcherMatches,\n match: fetcherMatch,\n controller: new AbortController()\n });\n }\n });\n return [navigationMatches, revalidatingFetchers];\n}\nfunction isNewLoader(currentLoaderData, currentMatch, match) {\n let isNew =\n // [a] -> [a, b]\n !currentMatch ||\n // [a, b] -> [a, c]\n match.route.id !== currentMatch.route.id;\n // Handle the case that we don't have data for a re-used route, potentially\n // from a prior error or from a cancelled pending deferred\n let isMissingData = currentLoaderData[match.route.id] === undefined;\n // Always load if this is a net-new route or we don't yet have data\n return isNew || isMissingData;\n}\nfunction isNewRouteInstance(currentMatch, match) {\n let currentPath = currentMatch.route.path;\n return (\n // param change for this match, /users/123 -> /users/456\n currentMatch.pathname !== match.pathname ||\n // splat param changed, which is not present in match.path\n // e.g. /files/images/avatar.jpg -> files/finances.xls\n currentPath != null && currentPath.endsWith(\"*\") && currentMatch.params[\"*\"] !== match.params[\"*\"]\n );\n}\nfunction shouldRevalidateLoader(loaderMatch, arg) {\n if (loaderMatch.route.shouldRevalidate) {\n let routeChoice = loaderMatch.route.shouldRevalidate(arg);\n if (typeof routeChoice === \"boolean\") {\n return routeChoice;\n }\n }\n return arg.defaultShouldRevalidate;\n}\n/**\n * Execute route.lazy() methods to lazily load route modules (loader, action,\n * shouldRevalidate) and update the routeManifest in place which shares objects\n * with dataRoutes so those get updated as well.\n */\nasync function loadLazyRouteModule(route, mapRouteProperties, manifest) {\n if (!route.lazy) {\n return;\n }\n let lazyRoute = await route.lazy();\n // If the lazy route function was executed and removed by another parallel\n // call then we can return - first lazy() to finish wins because the return\n // value of lazy is expected to be static\n if (!route.lazy) {\n return;\n }\n let routeToUpdate = manifest[route.id];\n invariant(routeToUpdate, \"No route found in manifest\");\n // Update the route in place. This should be safe because there's no way\n // we could yet be sitting on this route as we can't get there without\n // resolving lazy() first.\n //\n // This is different than the HMR \"update\" use-case where we may actively be\n // on the route being updated. The main concern boils down to \"does this\n // mutation affect any ongoing navigations or any current state.matches\n // values?\". If not, it should be safe to update in place.\n let routeUpdates = {};\n for (let lazyRouteProperty in lazyRoute) {\n let staticRouteValue = routeToUpdate[lazyRouteProperty];\n let isPropertyStaticallyDefined = staticRouteValue !== undefined &&\n // This property isn't static since it should always be updated based\n // on the route updates\n lazyRouteProperty !== \"hasErrorBoundary\";\n warning(!isPropertyStaticallyDefined, \"Route \\\"\" + routeToUpdate.id + \"\\\" has a static property \\\"\" + lazyRouteProperty + \"\\\" \" + \"defined but its lazy function is also returning a value for this property. \" + (\"The lazy route property \\\"\" + lazyRouteProperty + \"\\\" will be ignored.\"));\n if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) {\n routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty];\n }\n }\n // Mutate the route with the provided updates. Do this first so we pass\n // the updated version to mapRouteProperties\n Object.assign(routeToUpdate, routeUpdates);\n // Mutate the `hasErrorBoundary` property on the route based on the route\n // updates and remove the `lazy` function so we don't resolve the lazy\n // route again.\n Object.assign(routeToUpdate, _extends({}, mapRouteProperties(routeToUpdate), {\n lazy: undefined\n }));\n}\nasync function callLoaderOrAction(type, request, match, matches, manifest, mapRouteProperties, basename, opts) {\n if (opts === void 0) {\n opts = {};\n }\n let resultType;\n let result;\n let onReject;\n let runHandler = handler => {\n // Setup a promise we can race against so that abort signals short circuit\n let reject;\n let abortPromise = new Promise((_, r) => reject = r);\n onReject = () => reject();\n request.signal.addEventListener(\"abort\", onReject);\n return Promise.race([handler({\n request,\n params: match.params,\n context: opts.requestContext\n }), abortPromise]);\n };\n try {\n let handler = match.route[type];\n if (match.route.lazy) {\n if (handler) {\n // Run statically defined handler in parallel with lazy()\n let values = await Promise.all([runHandler(handler), loadLazyRouteModule(match.route, mapRouteProperties, manifest)]);\n result = values[0];\n } else {\n // Load lazy route module, then run any returned handler\n await loadLazyRouteModule(match.route, mapRouteProperties, manifest);\n handler = match.route[type];\n if (handler) {\n // Handler still run even if we got interrupted to maintain consistency\n // with un-abortable behavior of handler execution on non-lazy or\n // previously-lazy-loaded routes\n result = await runHandler(handler);\n } else if (type === \"action\") {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(405, {\n method: request.method,\n pathname,\n routeId: match.route.id\n });\n } else {\n // lazy() route has no loader to run. Short circuit here so we don't\n // hit the invariant below that errors on returning undefined.\n return {\n type: ResultType.data,\n data: undefined\n };\n }\n }\n } else if (!handler) {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(404, {\n pathname\n });\n } else {\n result = await runHandler(handler);\n }\n invariant(result !== undefined, \"You defined \" + (type === \"action\" ? \"an action\" : \"a loader\") + \" for route \" + (\"\\\"\" + match.route.id + \"\\\" but didn't return anything from your `\" + type + \"` \") + \"function. Please return a value or `null`.\");\n } catch (e) {\n resultType = ResultType.error;\n result = e;\n } finally {\n if (onReject) {\n request.signal.removeEventListener(\"abort\", onReject);\n }\n }\n if (isResponse(result)) {\n let status = result.status;\n // Process redirects\n if (redirectStatusCodes.has(status)) {\n let location = result.headers.get(\"Location\");\n invariant(location, \"Redirects returned/thrown from loaders/actions must have a Location header\");\n // Support relative routing in internal redirects\n if (!ABSOLUTE_URL_REGEX.test(location)) {\n location = normalizeTo(new URL(request.url), matches.slice(0, matches.indexOf(match) + 1), basename, true, location);\n } else if (!opts.isStaticRequest) {\n // Strip off the protocol+origin for same-origin + same-basename absolute\n // redirects. If this is a static request, we can let it go back to the\n // browser as-is\n let currentUrl = new URL(request.url);\n let url = location.startsWith(\"//\") ? new URL(currentUrl.protocol + location) : new URL(location);\n let isSameBasename = stripBasename(url.pathname, basename) != null;\n if (url.origin === currentUrl.origin && isSameBasename) {\n location = url.pathname + url.search + url.hash;\n }\n }\n // Don't process redirects in the router during static requests requests.\n // Instead, throw the Response and let the server handle it with an HTTP\n // redirect. We also update the Location header in place in this flow so\n // basename and relative routing is taken into account\n if (opts.isStaticRequest) {\n result.headers.set(\"Location\", location);\n throw result;\n }\n return {\n type: ResultType.redirect,\n status,\n location,\n revalidate: result.headers.get(\"X-Remix-Revalidate\") !== null,\n reloadDocument: result.headers.get(\"X-Remix-Reload-Document\") !== null\n };\n }\n // For SSR single-route requests, we want to hand Responses back directly\n // without unwrapping. We do this with the QueryRouteResponse wrapper\n // interface so we can know whether it was returned or thrown\n if (opts.isRouteRequest) {\n let queryRouteResponse = {\n type: resultType === ResultType.error ? ResultType.error : ResultType.data,\n response: result\n };\n throw queryRouteResponse;\n }\n let data;\n let contentType = result.headers.get(\"Content-Type\");\n // Check between word boundaries instead of startsWith() due to the last\n // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type\n if (contentType && /\\bapplication\\/json\\b/.test(contentType)) {\n data = await result.json();\n } else {\n data = await result.text();\n }\n if (resultType === ResultType.error) {\n return {\n type: resultType,\n error: new ErrorResponse(status, result.statusText, data),\n headers: result.headers\n };\n }\n return {\n type: ResultType.data,\n data,\n statusCode: result.status,\n headers: result.headers\n };\n }\n if (resultType === ResultType.error) {\n return {\n type: resultType,\n error: result\n };\n }\n if (isDeferredData(result)) {\n var _result$init, _result$init2;\n return {\n type: ResultType.deferred,\n deferredData: result,\n statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,\n headers: ((_result$init2 = result.init) == null ? void 0 : _result$init2.headers) && new Headers(result.init.headers)\n };\n }\n return {\n type: ResultType.data,\n data: result\n };\n}\n// Utility method for creating the Request instances for loaders/actions during\n// client-side navigations and fetches. During SSR we will always have a\n// Request instance from the static handler (query/queryRoute)\nfunction createClientSideRequest(history, location, signal, submission) {\n let url = history.createURL(stripHashFromPath(location)).toString();\n let init = {\n signal\n };\n if (submission && isMutationMethod(submission.formMethod)) {\n let {\n formMethod,\n formEncType\n } = submission;\n // Didn't think we needed this but it turns out unlike other methods, patch\n // won't be properly normalized to uppercase and results in a 405 error.\n // See: https://fetch.spec.whatwg.org/#concept-method\n init.method = formMethod.toUpperCase();\n if (formEncType === \"application/json\") {\n init.headers = new Headers({\n \"Content-Type\": formEncType\n });\n init.body = JSON.stringify(submission.json);\n } else if (formEncType === \"text/plain\") {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.text;\n } else if (formEncType === \"application/x-www-form-urlencoded\" && submission.formData) {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = convertFormDataToSearchParams(submission.formData);\n } else {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.formData;\n }\n }\n return new Request(url, init);\n}\nfunction convertFormDataToSearchParams(formData) {\n let searchParams = new URLSearchParams();\n for (let [key, value] of formData.entries()) {\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs\n searchParams.append(key, typeof value === \"string\" ? value : value.name);\n }\n return searchParams;\n}\nfunction convertSearchParamsToFormData(searchParams) {\n let formData = new FormData();\n for (let [key, value] of searchParams.entries()) {\n formData.append(key, value);\n }\n return formData;\n}\nfunction processRouteLoaderData(matches, matchesToLoad, results, pendingError, activeDeferreds) {\n // Fill in loaderData/errors from our loaders\n let loaderData = {};\n let errors = null;\n let statusCode;\n let foundError = false;\n let loaderHeaders = {};\n // Process loader results into state.loaderData/state.errors\n results.forEach((result, index) => {\n let id = matchesToLoad[index].route.id;\n invariant(!isRedirectResult(result), \"Cannot handle redirect results in processLoaderData\");\n if (isErrorResult(result)) {\n // Look upwards from the matched route for the closest ancestor\n // error boundary, defaulting to the root match\n let boundaryMatch = findNearestBoundary(matches, id);\n let error = result.error;\n // If we have a pending action error, we report it at the highest-route\n // that throws a loader error, and then clear it out to indicate that\n // it was consumed\n if (pendingError) {\n error = Object.values(pendingError)[0];\n pendingError = undefined;\n }\n errors = errors || {};\n // Prefer higher error values if lower errors bubble to the same boundary\n if (errors[boundaryMatch.route.id] == null) {\n errors[boundaryMatch.route.id] = error;\n }\n // Clear our any prior loaderData for the throwing route\n loaderData[id] = undefined;\n // Once we find our first (highest) error, we set the status code and\n // prevent deeper status codes from overriding\n if (!foundError) {\n foundError = true;\n statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n if (isDeferredResult(result)) {\n activeDeferreds.set(id, result.deferredData);\n loaderData[id] = result.deferredData.data;\n } else {\n loaderData[id] = result.data;\n }\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode != null && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n }\n });\n // If we didn't consume the pending action error (i.e., all loaders\n // resolved), then consume it here. Also clear out any loaderData for the\n // throwing route\n if (pendingError) {\n errors = pendingError;\n loaderData[Object.keys(pendingError)[0]] = undefined;\n }\n return {\n loaderData,\n errors,\n statusCode: statusCode || 200,\n loaderHeaders\n };\n}\nfunction processLoaderData(state, matches, matchesToLoad, results, pendingError, revalidatingFetchers, fetcherResults, activeDeferreds) {\n let {\n loaderData,\n errors\n } = processRouteLoaderData(matches, matchesToLoad, results, pendingError, activeDeferreds);\n // Process results from our revalidating fetchers\n for (let index = 0; index < revalidatingFetchers.length; index++) {\n let {\n key,\n match,\n controller\n } = revalidatingFetchers[index];\n invariant(fetcherResults !== undefined && fetcherResults[index] !== undefined, \"Did not find corresponding fetcher result\");\n let result = fetcherResults[index];\n // Process fetcher non-redirect errors\n if (controller && controller.signal.aborted) {\n // Nothing to do for aborted fetchers\n continue;\n } else if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id);\n if (!(errors && errors[boundaryMatch.route.id])) {\n errors = _extends({}, errors, {\n [boundaryMatch.route.id]: result.error\n });\n }\n state.fetchers.delete(key);\n } else if (isRedirectResult(result)) {\n // Should never get here, redirects should get processed above, but we\n // keep this to type narrow to a success result in the else\n invariant(false, \"Unhandled fetcher revalidation redirect\");\n } else if (isDeferredResult(result)) {\n // Should never get here, deferred data should be awaited for fetchers\n // in resolveDeferredResults\n invariant(false, \"Unhandled fetcher deferred data\");\n } else {\n let doneFetcher = getDoneFetcher(result.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n return {\n loaderData,\n errors\n };\n}\nfunction mergeLoaderData(loaderData, newLoaderData, matches, errors) {\n let mergedLoaderData = _extends({}, newLoaderData);\n for (let match of matches) {\n let id = match.route.id;\n if (newLoaderData.hasOwnProperty(id)) {\n if (newLoaderData[id] !== undefined) {\n mergedLoaderData[id] = newLoaderData[id];\n }\n } else if (loaderData[id] !== undefined && match.route.loader) {\n // Preserve existing keys not included in newLoaderData and where a loader\n // wasn't removed by HMR\n mergedLoaderData[id] = loaderData[id];\n }\n if (errors && errors.hasOwnProperty(id)) {\n // Don't keep any loader data below the boundary\n break;\n }\n }\n return mergedLoaderData;\n}\n// Find the nearest error boundary, looking upwards from the leaf route (or the\n// route specified by routeId) for the closest ancestor error boundary,\n// defaulting to the root match\nfunction findNearestBoundary(matches, routeId) {\n let eligibleMatches = routeId ? matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1) : [...matches];\n return eligibleMatches.reverse().find(m => m.route.hasErrorBoundary === true) || matches[0];\n}\nfunction getShortCircuitMatches(routes) {\n // Prefer a root layout route if present, otherwise shim in a route object\n let route = routes.find(r => r.index || !r.path || r.path === \"/\") || {\n id: \"__shim-error-route__\"\n };\n return {\n matches: [{\n params: {},\n pathname: \"\",\n pathnameBase: \"\",\n route\n }],\n route\n };\n}\nfunction getInternalRouterError(status, _temp4) {\n let {\n pathname,\n routeId,\n method,\n type\n } = _temp4 === void 0 ? {} : _temp4;\n let statusText = \"Unknown Server Error\";\n let errorMessage = \"Unknown @remix-run/router error\";\n if (status === 400) {\n statusText = \"Bad Request\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide a `loader` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (type === \"defer-action\") {\n errorMessage = \"defer() is not supported in actions\";\n } else if (type === \"invalid-body\") {\n errorMessage = \"Unable to encode submission body\";\n }\n } else if (status === 403) {\n statusText = \"Forbidden\";\n errorMessage = \"Route \\\"\" + routeId + \"\\\" does not match URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 404) {\n statusText = \"Not Found\";\n errorMessage = \"No route matches URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 405) {\n statusText = \"Method Not Allowed\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method.toUpperCase() + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide an `action` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (method) {\n errorMessage = \"Invalid request method \\\"\" + method.toUpperCase() + \"\\\"\";\n }\n }\n return new ErrorResponse(status || 500, statusText, new Error(errorMessage), true);\n}\n// Find any returned redirect errors, starting from the lowest match\nfunction findRedirect(results) {\n for (let i = results.length - 1; i >= 0; i--) {\n let result = results[i];\n if (isRedirectResult(result)) {\n return {\n result,\n idx: i\n };\n }\n }\n}\nfunction stripHashFromPath(path) {\n let parsedPath = typeof path === \"string\" ? parsePath(path) : path;\n return createPath(_extends({}, parsedPath, {\n hash: \"\"\n }));\n}\nfunction isHashChangeOnly(a, b) {\n if (a.pathname !== b.pathname || a.search !== b.search) {\n return false;\n }\n if (a.hash === \"\") {\n // /page -> /page#hash\n return b.hash !== \"\";\n } else if (a.hash === b.hash) {\n // /page#hash -> /page#hash\n return true;\n } else if (b.hash !== \"\") {\n // /page#hash -> /page#other\n return true;\n }\n // If the hash is removed the browser will re-perform a request to the server\n // /page#hash -> /page\n return false;\n}\nfunction isDeferredResult(result) {\n return result.type === ResultType.deferred;\n}\nfunction isErrorResult(result) {\n return result.type === ResultType.error;\n}\nfunction isRedirectResult(result) {\n return (result && result.type) === ResultType.redirect;\n}\nfunction isDeferredData(value) {\n let deferred = value;\n return deferred && typeof deferred === \"object\" && typeof deferred.data === \"object\" && typeof deferred.subscribe === \"function\" && typeof deferred.cancel === \"function\" && typeof deferred.resolveData === \"function\";\n}\nfunction isResponse(value) {\n return value != null && typeof value.status === \"number\" && typeof value.statusText === \"string\" && typeof value.headers === \"object\" && typeof value.body !== \"undefined\";\n}\nfunction isRedirectResponse(result) {\n if (!isResponse(result)) {\n return false;\n }\n let status = result.status;\n let location = result.headers.get(\"Location\");\n return status >= 300 && status <= 399 && location != null;\n}\nfunction isQueryRouteResponse(obj) {\n return obj && isResponse(obj.response) && (obj.type === ResultType.data || obj.type === ResultType.error);\n}\nfunction isValidMethod(method) {\n return validRequestMethods.has(method.toLowerCase());\n}\nfunction isMutationMethod(method) {\n return validMutationMethods.has(method.toLowerCase());\n}\nasync function resolveDeferredResults(currentMatches, matchesToLoad, results, signals, isFetcher, currentLoaderData) {\n for (let index = 0; index < results.length; index++) {\n let result = results[index];\n let match = matchesToLoad[index];\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n let currentMatch = currentMatches.find(m => m.route.id === match.route.id);\n let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== undefined;\n if (isDeferredResult(result) && (isFetcher || isRevalidatingLoader)) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n let signal = signals[index];\n invariant(signal, \"Expected an AbortSignal for revalidating fetcher deferred result\");\n await resolveDeferredData(result, signal, isFetcher).then(result => {\n if (result) {\n results[index] = result || results[index];\n }\n });\n }\n }\n}\nasync function resolveDeferredData(result, signal, unwrap) {\n if (unwrap === void 0) {\n unwrap = false;\n }\n let aborted = await result.deferredData.resolveData(signal);\n if (aborted) {\n return;\n }\n if (unwrap) {\n try {\n return {\n type: ResultType.data,\n data: result.deferredData.unwrappedData\n };\n } catch (e) {\n // Handle any TrackedPromise._error values encountered while unwrapping\n return {\n type: ResultType.error,\n error: e\n };\n }\n }\n return {\n type: ResultType.data,\n data: result.deferredData.data\n };\n}\nfunction hasNakedIndexQuery(search) {\n return new URLSearchParams(search).getAll(\"index\").some(v => v === \"\");\n}\n// Note: This should match the format exported by useMatches, so if you change\n// this please also change that :) Eventually we'll DRY this up\nfunction createUseMatchesMatch(match, loaderData) {\n let {\n route,\n pathname,\n params\n } = match;\n return {\n id: route.id,\n pathname,\n params,\n data: loaderData[route.id],\n handle: route.handle\n };\n}\nfunction getTargetMatch(matches, location) {\n let search = typeof location === \"string\" ? parsePath(location).search : location.search;\n if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || \"\")) {\n // Return the leaf index route when index is present\n return matches[matches.length - 1];\n }\n // Otherwise grab the deepest \"path contributing\" match (ignoring index and\n // pathless layout routes)\n let pathMatches = getPathContributingMatches(matches);\n return pathMatches[pathMatches.length - 1];\n}\nfunction getSubmissionFromNavigation(navigation) {\n let {\n formMethod,\n formAction,\n formEncType,\n text,\n formData,\n json\n } = navigation;\n if (!formMethod || !formAction || !formEncType) {\n return;\n }\n if (text != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json: undefined,\n text\n };\n } else if (formData != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData,\n json: undefined,\n text: undefined\n };\n } else if (json !== undefined) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json,\n text: undefined\n };\n }\n}\nfunction getLoadingNavigation(location, submission) {\n if (submission) {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n } else {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n };\n return navigation;\n }\n}\nfunction getSubmittingNavigation(location, submission) {\n let navigation = {\n state: \"submitting\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n}\nfunction getLoadingFetcher(submission, data) {\n if (submission) {\n let fetcher = {\n state: \"loading\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data,\n \" _hasFetcherDoneAnything \": true\n };\n return fetcher;\n } else {\n let fetcher = {\n state: \"loading\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data,\n \" _hasFetcherDoneAnything \": true\n };\n return fetcher;\n }\n}\nfunction getSubmittingFetcher(submission, existingFetcher) {\n let fetcher = {\n state: \"submitting\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data: existingFetcher ? existingFetcher.data : undefined,\n \" _hasFetcherDoneAnything \": true\n };\n return fetcher;\n}\nfunction getDoneFetcher(data) {\n let fetcher = {\n state: \"idle\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data,\n \" _hasFetcherDoneAnything \": true\n };\n return fetcher;\n}\n//#endregion\n\nexport { AbortedDeferredError, Action, ErrorResponse, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getPathContributingMatches as UNSAFE_getPathContributingMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, defer, generatePath, getStaticContextFromError, getToPathname, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, redirectDocument, resolvePath, resolveTo, stripBasename };\n//# sourceMappingURL=router.js.map\n","/**\n * React Router v6.15.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React from 'react';\nimport { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_getPathContributingMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, stripBasename, IDLE_BLOCKER, isRouteErrorResponse, createMemoryHistory, AbortedDeferredError, createRouter } from '@remix-run/router';\nexport { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, resolvePath } from '@remix-run/router';\n\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n// Create react-specific types from the agnostic types in @remix-run/router to\n// export from react-router\nconst DataRouterContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterContext.displayName = \"DataRouter\";\n}\nconst DataRouterStateContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\nconst AwaitContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n AwaitContext.displayName = \"Await\";\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\n\nconst NavigationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n NavigationContext.displayName = \"Navigation\";\n}\nconst LocationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n LocationContext.displayName = \"Location\";\n}\nconst RouteContext = /*#__PURE__*/React.createContext({\n outlet: null,\n matches: [],\n isDataRoute: false\n});\nif (process.env.NODE_ENV !== \"production\") {\n RouteContext.displayName = \"Route\";\n}\nconst RouteErrorContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n RouteErrorContext.displayName = \"RouteError\";\n}\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/hooks/use-href\n */\nfunction useHref(to, _temp) {\n let {\n relative\n } = _temp === void 0 ? {} : _temp;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useHref() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n hash,\n pathname,\n search\n } = useResolvedPath(to, {\n relative\n });\n let joinedPathname = pathname;\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n if (basename !== \"/\") {\n joinedPathname = pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n return navigator.createHref({\n pathname: joinedPathname,\n search,\n hash\n });\n}\n\n/**\n * Returns true if this component is a descendant of a .\n *\n * @see https://reactrouter.com/hooks/use-in-router-context\n */\nfunction useInRouterContext() {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/hooks/use-location\n */\nfunction useLocation() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useLocation() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/hooks/use-navigation-type\n */\nfunction useNavigationType() {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns a PathMatch object if the given pattern matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * .\n *\n * @see https://reactrouter.com/hooks/use-match\n */\nfunction useMatch(pattern) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useMatch() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n pathname\n } = useLocation();\n return React.useMemo(() => matchPath(pattern, pathname), [pathname, pattern]);\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\n\nconst navigateEffectWarning = \"You should call navigate() in a React.useEffect(), not when \" + \"your component is first rendered.\";\n\n// Mute warnings for calls to useNavigate in SSR environments\nfunction useIsomorphicLayoutEffect(cb) {\n let isStatic = React.useContext(NavigationContext).static;\n if (!isStatic) {\n // We should be able to get rid of this once react 18.3 is released\n // See: https://github.com/facebook/react/pull/26395\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(cb);\n }\n}\n\n/**\n * Returns an imperative method for changing the location. Used by s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/hooks/use-navigate\n */\nfunction useNavigate() {\n let {\n isDataRoute\n } = React.useContext(RouteContext);\n // Conditional usage is OK here because the usage of a data router is static\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isDataRoute ? useNavigateStable() : useNavigateUnstable();\n}\nfunction useNavigateUnstable() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useNavigate() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let dataRouterContext = React.useContext(DataRouterContext);\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our history listener yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === \"path\");\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history (but only if we're not in a data router,\n // otherwise it'll prepend the basename inside of the router).\n // If this is a root navigation, then we navigate to the raw basename\n // which allows the basename to have full control over the presence of a\n // trailing slash on root links\n if (dataRouterContext == null && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);\n }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);\n return navigate;\n}\nconst OutletContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/hooks/use-outlet-context\n */\nfunction useOutletContext() {\n return React.useContext(OutletContext);\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by to render child routes.\n *\n * @see https://reactrouter.com/hooks/use-outlet\n */\nfunction useOutlet(context) {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return /*#__PURE__*/React.createElement(OutletContext.Provider, {\n value: context\n }, outlet);\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/hooks/use-params\n */\nfunction useParams() {\n let {\n matches\n } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? routeMatch.params : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/hooks/use-resolved-path\n */\nfunction useResolvedPath(to, _temp2) {\n let {\n relative\n } = _temp2 === void 0 ? {} : _temp2;\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));\n return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === \"path\"), [to, routePathnamesJson, locationPathname, relative]);\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an to render their child route's\n * element.\n *\n * @see https://reactrouter.com/hooks/use-routes\n */\nfunction useRoutes(routes, locationArg) {\n return useRoutesImpl(routes, locationArg);\n}\n\n// Internal implementation with accept optional param for RouterProvider usage\nfunction useRoutesImpl(routes, locationArg, dataRouterState) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useRoutes() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches: parentMatches\n } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n if (process.env.NODE_ENV !== \"production\") {\n // You won't get a warning about 2 different under a \n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // \n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // } />\n // } />\n // \n //\n // function Blog() {\n // return (\n // \n // } />\n // \n // );\n // }\n let parentPath = parentRoute && parentRoute.path || \"\";\n warningOnce(parentPathname, !parentRoute || parentPath.endsWith(\"*\"), \"You rendered descendant (or called `useRoutes()`) at \" + (\"\\\"\" + parentPathname + \"\\\" (under ) but the \") + \"parent route path has no trailing \\\"*\\\". This means if you navigate \" + \"deeper, the parent won't match anymore and therefore the child \" + \"routes will never render.\\n\\n\" + (\"Please change the parent to .\"));\n }\n let locationFromContext = useLocation();\n let location;\n if (locationArg) {\n var _parsedLocationArg$pa;\n let parsedLocationArg = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n !(parentPathnameBase === \"/\" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"When overriding the location using `` or `useRoutes(routes, location)`, \" + \"the location pathname must begin with the portion of the URL pathname that was \" + (\"matched by all parent routes. The current pathname base is \\\"\" + parentPathnameBase + \"\\\" \") + (\"but pathname \\\"\" + parsedLocationArg.pathname + \"\\\" was given in the `location` prop.\")) : UNSAFE_invariant(false) : void 0;\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n let pathname = location.pathname || \"/\";\n let remainingPathname = parentPathnameBase === \"/\" ? pathname : pathname.slice(parentPathnameBase.length) || \"/\";\n let matches = matchRoutes(routes, {\n pathname: remainingPathname\n });\n if (process.env.NODE_ENV !== \"production\") {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(parentRoute || matches != null, \"No routes matched location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \") : void 0;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined, \"Matched leaf route at location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \" + \"does not have an element or Component. This means it will render an with a \" + \"null value by default resulting in an \\\"empty\\\" page.\") : void 0;\n }\n let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),\n pathnameBase: match.pathnameBase === \"/\" ? parentPathnameBase : joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])\n })), parentMatches, dataRouterState);\n\n // When a user passes in a `locationArg`, the associated routes need to\n // be wrapped in a new `LocationContext.Provider` in order for `useLocation`\n // to use the scoped location instead of the global location.\n if (locationArg && renderedMatches) {\n return /*#__PURE__*/React.createElement(LocationContext.Provider, {\n value: {\n location: _extends({\n pathname: \"/\",\n search: \"\",\n hash: \"\",\n state: null,\n key: \"default\"\n }, location),\n navigationType: Action.Pop\n }\n }, renderedMatches);\n }\n return renderedMatches;\n}\nfunction DefaultErrorComponent() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error) ? error.status + \" \" + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = {\n padding: \"0.5rem\",\n backgroundColor: lightgrey\n };\n let codeStyles = {\n padding: \"2px 4px\",\n backgroundColor: lightgrey\n };\n let devInfo = null;\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Error handled by React Router default ErrorBoundary:\", error);\n devInfo = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"p\", null, \"\\uD83D\\uDCBF Hey developer \\uD83D\\uDC4B\"), /*#__PURE__*/React.createElement(\"p\", null, \"You can provide a way better UX than this when your app throws errors by providing your own \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"ErrorBoundary\"), \" or\", \" \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"errorElement\"), \" prop on your route.\"));\n }\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"h2\", null, \"Unexpected Application Error!\"), /*#__PURE__*/React.createElement(\"h3\", {\n style: {\n fontStyle: \"italic\"\n }\n }, message), stack ? /*#__PURE__*/React.createElement(\"pre\", {\n style: preStyles\n }, stack) : null, devInfo);\n}\nconst defaultErrorElement = /*#__PURE__*/React.createElement(DefaultErrorComponent, null);\nclass RenderErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n location: props.location,\n revalidation: props.revalidation,\n error: props.error\n };\n }\n static getDerivedStateFromError(error) {\n return {\n error: error\n };\n }\n static getDerivedStateFromProps(props, state) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location || state.revalidation !== \"idle\" && props.revalidation === \"idle\") {\n return {\n error: props.error,\n location: props.location,\n revalidation: props.revalidation\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error || state.error,\n location: state.location,\n revalidation: props.revalidation || state.revalidation\n };\n }\n componentDidCatch(error, errorInfo) {\n console.error(\"React Router caught the following error during render\", error, errorInfo);\n }\n render() {\n return this.state.error ? /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: this.props.routeContext\n }, /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {\n value: this.state.error,\n children: this.props.component\n })) : this.props.children;\n }\n}\nfunction RenderedRoute(_ref) {\n let {\n routeContext,\n match,\n children\n } = _ref;\n let dataRouterContext = React.useContext(DataRouterContext);\n\n // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {\n dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;\n }\n return /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: routeContext\n }, children);\n}\nfunction _renderMatches(matches, parentMatches, dataRouterState) {\n var _dataRouterState2;\n if (parentMatches === void 0) {\n parentMatches = [];\n }\n if (dataRouterState === void 0) {\n dataRouterState = null;\n }\n if (matches == null) {\n var _dataRouterState;\n if ((_dataRouterState = dataRouterState) != null && _dataRouterState.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches;\n } else {\n return null;\n }\n }\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = (_dataRouterState2 = dataRouterState) == null ? void 0 : _dataRouterState2.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]));\n !(errorIndex >= 0) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"Could not find a matching route for errors on route IDs: \" + Object.keys(errors).join(\",\")) : UNSAFE_invariant(false) : void 0;\n renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));\n }\n return renderedMatches.reduceRight((outlet, match, index) => {\n let error = match.route.id ? errors == null ? void 0 : errors[match.route.id] : null;\n // Only data routers handle errors\n let errorElement = null;\n if (dataRouterState) {\n errorElement = match.route.errorElement || defaultErrorElement;\n }\n let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));\n let getChildren = () => {\n let children;\n if (error) {\n children = errorElement;\n } else if (match.route.Component) {\n // Note: This is a de-optimized path since React won't re-use the\n // ReactElement since it's identity changes with each new\n // React.createElement call. We keep this so folks can use\n // `` in `` but generally `Component`\n // usage is only advised in `RouterProvider` when we can convert it to\n // `element` ahead of time.\n children = /*#__PURE__*/React.createElement(match.route.Component, null);\n } else if (match.route.element) {\n children = match.route.element;\n } else {\n children = outlet;\n }\n return /*#__PURE__*/React.createElement(RenderedRoute, {\n match: match,\n routeContext: {\n outlet,\n matches,\n isDataRoute: dataRouterState != null\n },\n children: children\n });\n };\n // Only wrap in an error boundary within data router usages when we have an\n // ErrorBoundary/errorElement on this route. Otherwise let it bubble up to\n // an ancestor ErrorBoundary/errorElement\n return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /*#__PURE__*/React.createElement(RenderErrorBoundary, {\n location: dataRouterState.location,\n revalidation: dataRouterState.revalidation,\n component: errorElement,\n error: error,\n children: getChildren(),\n routeContext: {\n outlet: null,\n matches,\n isDataRoute: true\n }\n }) : getChildren();\n }, null);\n}\nvar DataRouterHook = /*#__PURE__*/function (DataRouterHook) {\n DataRouterHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterHook[\"UseNavigateStable\"] = \"useNavigate\";\n return DataRouterHook;\n}(DataRouterHook || {});\nvar DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {\n DataRouterStateHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterStateHook[\"UseLoaderData\"] = \"useLoaderData\";\n DataRouterStateHook[\"UseActionData\"] = \"useActionData\";\n DataRouterStateHook[\"UseRouteError\"] = \"useRouteError\";\n DataRouterStateHook[\"UseNavigation\"] = \"useNavigation\";\n DataRouterStateHook[\"UseRouteLoaderData\"] = \"useRouteLoaderData\";\n DataRouterStateHook[\"UseMatches\"] = \"useMatches\";\n DataRouterStateHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterStateHook[\"UseNavigateStable\"] = \"useNavigate\";\n DataRouterStateHook[\"UseRouteId\"] = \"useRouteId\";\n return DataRouterStateHook;\n}(DataRouterStateHook || {});\nfunction getDataRouterConsoleError(hookName) {\n return hookName + \" must be used within a data router. See https://reactrouter.com/routers/picking-a-router.\";\n}\nfunction useDataRouterContext(hookName) {\n let ctx = React.useContext(DataRouterContext);\n !ctx ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return ctx;\n}\nfunction useDataRouterState(hookName) {\n let state = React.useContext(DataRouterStateContext);\n !state ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return state;\n}\nfunction useRouteContext(hookName) {\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return route;\n}\n\n// Internal version with hookName-aware debugging\nfunction useCurrentRouteId(hookName) {\n let route = useRouteContext(hookName);\n let thisRoute = route.matches[route.matches.length - 1];\n !thisRoute.route.id ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, hookName + \" can only be used on routes that contain a unique \\\"id\\\"\") : UNSAFE_invariant(false) : void 0;\n return thisRoute.route.id;\n}\n\n/**\n * Returns the ID for the nearest contextual route\n */\nfunction useRouteId() {\n return useCurrentRouteId(DataRouterStateHook.UseRouteId);\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nfunction useNavigation() {\n let state = useDataRouterState(DataRouterStateHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nfunction useRevalidator() {\n let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);\n let state = useDataRouterState(DataRouterStateHook.UseRevalidator);\n return React.useMemo(() => ({\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation\n }), [dataRouterContext.router.revalidate, state.revalidation]);\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nfunction useMatches() {\n let {\n matches,\n loaderData\n } = useDataRouterState(DataRouterStateHook.UseMatches);\n return React.useMemo(() => matches.map(match => {\n let {\n pathname,\n params\n } = match;\n // Note: This structure matches that created by createUseMatchesMatch\n // in the @remix-run/router , so if you change this please also change\n // that :) Eventually we'll DRY this up\n return {\n id: match.route.id,\n pathname,\n params,\n data: loaderData[match.route.id],\n handle: match.route.handle\n };\n }), [matches, loaderData]);\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nfunction useLoaderData() {\n let state = useDataRouterState(DataRouterStateHook.UseLoaderData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n if (state.errors && state.errors[routeId] != null) {\n console.error(\"You cannot `useLoaderData` in an errorElement (routeId: \" + routeId + \")\");\n return undefined;\n }\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nfunction useRouteLoaderData(routeId) {\n let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nfunction useActionData() {\n let state = useDataRouterState(DataRouterStateHook.UseActionData);\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"useActionData must be used inside a RouteContext\") : UNSAFE_invariant(false) : void 0;\n return Object.values((state == null ? void 0 : state.actionData) || {})[0];\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * ErrorBoundary/errorElement to display a proper error message.\n */\nfunction useRouteError() {\n var _state$errors;\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterStateHook.UseRouteError);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error) {\n return error;\n }\n\n // Otherwise look for errors from our data router state\n return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];\n}\n\n/**\n * Returns the happy-path data from the nearest ancestor value\n */\nfunction useAsyncValue() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._data;\n}\n\n/**\n * Returns the error from the nearest ancestor value\n */\nfunction useAsyncError() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._error;\n}\nlet blockerId = 0;\n\n/**\n * Allow the application to block navigations within the SPA and present the\n * user a confirmation dialog to confirm the navigation. Mostly used to avoid\n * using half-filled form data. This does not handle hard-reloads or\n * cross-origin navigations.\n */\nfunction useBlocker(shouldBlock) {\n let {\n router,\n basename\n } = useDataRouterContext(DataRouterHook.UseBlocker);\n let state = useDataRouterState(DataRouterStateHook.UseBlocker);\n let [blockerKey, setBlockerKey] = React.useState(\"\");\n let blockerFunction = React.useCallback(arg => {\n if (typeof shouldBlock !== \"function\") {\n return !!shouldBlock;\n }\n if (basename === \"/\") {\n return shouldBlock(arg);\n }\n\n // If they provided us a function and we've got an active basename, strip\n // it from the locations we expose to the user to match the behavior of\n // useLocation\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = arg;\n return shouldBlock({\n currentLocation: _extends({}, currentLocation, {\n pathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname\n }),\n nextLocation: _extends({}, nextLocation, {\n pathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname\n }),\n historyAction\n });\n }, [basename, shouldBlock]);\n\n // This effect is in charge of blocker key assignment and deletion (which is\n // tightly coupled to the key)\n React.useEffect(() => {\n let key = String(++blockerId);\n setBlockerKey(key);\n return () => router.deleteBlocker(key);\n }, [router]);\n\n // This effect handles assigning the blockerFunction. This is to handle\n // unstable blocker function identities, and happens only after the prior\n // effect so we don't get an orphaned blockerFunction in the router with a\n // key of \"\". Until then we just have the IDLE_BLOCKER.\n React.useEffect(() => {\n if (blockerKey !== \"\") {\n router.getBlocker(blockerKey, blockerFunction);\n }\n }, [router, blockerKey, blockerFunction]);\n\n // Prefer the blocker from `state` not `router.state` since DataRouterContext\n // is memoized so this ensures we update on blocker state updates\n return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER;\n}\n\n/**\n * Stable version of useNavigate that is used when we are in the context of\n * a RouterProvider.\n */\nfunction useNavigateStable() {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseNavigateStable);\n let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our router subscriber yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n router.navigate(to);\n } else {\n router.navigate(to, _extends({\n fromRouteId: id\n }, options));\n }\n }, [router, id]);\n return navigate;\n}\nconst alreadyWarned = {};\nfunction warningOnce(key, cond, message) {\n if (!cond && !alreadyWarned[key]) {\n alreadyWarned[key] = true;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, message) : void 0;\n }\n}\n\n/**\n Webpack + React 17 fails to compile on any of the following because webpack\n complains that `startTransition` doesn't exist in `React`:\n * import { startTransition } from \"react\"\n * import * as React from from \"react\";\n \"startTransition\" in React ? React.startTransition(() => setState()) : setState()\n * import * as React from from \"react\";\n \"startTransition\" in React ? React[\"startTransition\"](() => setState()) : setState()\n\n Moving it to a constant such as the following solves the Webpack/React 17 issue:\n * import * as React from from \"react\";\n const START_TRANSITION = \"startTransition\";\n START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()\n\n However, that introduces webpack/terser minification issues in production builds\n in React 18 where minification/obfuscation ends up removing the call of\n React.startTransition entirely from the first half of the ternary. Grabbing\n this exported reference once up front resolves that issue.\n\n See https://github.com/remix-run/react-router/issues/10579\n*/\nconst START_TRANSITION = \"startTransition\";\nconst startTransitionImpl = React[START_TRANSITION];\n\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nfunction RouterProvider(_ref) {\n let {\n fallbackElement,\n router,\n future\n } = _ref;\n // Need to use a layout effect here so we are subscribed early enough to\n // pick up on any render-driven redirects/navigations (useEffect/)\n let [state, setStateImpl] = React.useState(router.state);\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);\n }, [setStateImpl, v7_startTransition]);\n React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n let navigator = React.useMemo(() => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: n => router.navigate(n),\n push: (to, state, opts) => router.navigate(to, {\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n }),\n replace: (to, state, opts) => router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n })\n };\n }, [router]);\n let basename = router.basename || \"/\";\n let dataRouterContext = React.useMemo(() => ({\n router,\n navigator,\n static: false,\n basename\n }), [router, navigator, basename]);\n\n // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a \n \nFor more info see: https://ag-grid.com/javascript-data-grid/getting-started/#getting-started-with-ag-grid-enterprise`;\n }\n }\n else if (ModuleRegistry.moduleBased || ModuleRegistry.moduleBased === undefined) {\n let modName = (_a = Object.entries(ModuleNames).find(([k, v]) => v === moduleName)) === null || _a === void 0 ? void 0 : _a[0];\n warningMessage =\n `AG Grid: unable to use ${reason} as the ${modName} is not registered${ModuleRegistry.areGridScopedModules ? ` for gridId: ${gridId}` : ''}. Check if you have registered the module:\n \n import { ModuleRegistry } from '@ag-grid-community/core';\n import { ${modName} } from '${moduleName}';\n \n ModuleRegistry.registerModules([ ${modName} ]);\n\nFor more info see: https://www.ag-grid.com/javascript-grid/modules/`;\n }\n else {\n warningMessage =\n `AG Grid: unable to use ${reason} as package 'ag-grid-enterprise' has not been imported. Check that you have imported the package:\n \n import 'ag-grid-enterprise';\n \nFor more info see: https://www.ag-grid.com/javascript-grid/packages/`;\n }\n doOnce(() => {\n console.warn(warningMessage);\n }, warningKey);\n return false;\n }\n /** AG GRID INTERNAL - Is the given module registered, globally or individually with this grid. */\n static __isRegistered(moduleName, gridId) {\n var _a;\n return !!ModuleRegistry.globalModulesMap[moduleName] || !!((_a = ModuleRegistry.gridModulesMap[gridId]) === null || _a === void 0 ? void 0 : _a[moduleName]);\n }\n /** AG GRID INTERNAL - Get all registered modules globally / individually for this grid. */\n static __getRegisteredModules(gridId) {\n return [...values(ModuleRegistry.globalModulesMap), ...values(ModuleRegistry.gridModulesMap[gridId] || {})];\n }\n /** AG GRID INTERNAL - Get the list of modules registered individually for this grid. */\n static __getGridRegisteredModules(gridId) {\n var _a;\n return values((_a = ModuleRegistry.gridModulesMap[gridId]) !== null && _a !== void 0 ? _a : {}) || [];\n }\n /** INTERNAL */\n static __isPackageBased() {\n return !ModuleRegistry.moduleBased;\n }\n}\n// having in a map a) removes duplicates and b) allows fast lookup\nModuleRegistry.globalModulesMap = {};\nModuleRegistry.gridModulesMap = {};\nModuleRegistry.areGridScopedModules = false;\n","import { exists, values } from \"../utils/generic.mjs\";\nimport { iterateObject } from \"../utils/object.mjs\";\nimport { getFunctionName } from \"../utils/function.mjs\";\nimport { ModuleRegistry } from \"../modules/moduleRegistry.mjs\";\nexport class Context {\n constructor(params, logger) {\n this.beanWrappers = {};\n this.destroyed = false;\n if (!params || !params.beanClasses) {\n return;\n }\n this.contextParams = params;\n this.logger = logger;\n this.logger.log(\">> creating ag-Application Context\");\n this.createBeans();\n const beanInstances = this.getBeanInstances();\n this.wireBeans(beanInstances);\n this.logger.log(\">> ag-Application Context ready - component is alive\");\n }\n getBeanInstances() {\n return values(this.beanWrappers).map(beanEntry => beanEntry.beanInstance);\n }\n createBean(bean, afterPreCreateCallback) {\n if (!bean) {\n throw Error(`Can't wire to bean since it is null`);\n }\n this.wireBeans([bean], afterPreCreateCallback);\n return bean;\n }\n wireBeans(beanInstances, afterPreCreateCallback) {\n this.autoWireBeans(beanInstances);\n this.methodWireBeans(beanInstances);\n this.callLifeCycleMethods(beanInstances, 'preConstructMethods');\n // the callback sets the attributes, so the component has access to attributes\n // before postConstruct methods in the component are executed\n if (exists(afterPreCreateCallback)) {\n beanInstances.forEach(afterPreCreateCallback);\n }\n this.callLifeCycleMethods(beanInstances, 'postConstructMethods');\n }\n createBeans() {\n // register all normal beans\n this.contextParams.beanClasses.forEach(this.createBeanWrapper.bind(this));\n // register override beans, these will overwrite beans above of same name\n // instantiate all beans - overridden beans will be left out\n iterateObject(this.beanWrappers, (key, beanEntry) => {\n let constructorParamsMeta;\n if (beanEntry.bean.__agBeanMetaData && beanEntry.bean.__agBeanMetaData.autowireMethods && beanEntry.bean.__agBeanMetaData.autowireMethods.agConstructor) {\n constructorParamsMeta = beanEntry.bean.__agBeanMetaData.autowireMethods.agConstructor;\n }\n const constructorParams = this.getBeansForParameters(constructorParamsMeta, beanEntry.bean.name);\n const newInstance = new (beanEntry.bean.bind.apply(beanEntry.bean, [null, ...constructorParams]));\n beanEntry.beanInstance = newInstance;\n });\n const createdBeanNames = Object.keys(this.beanWrappers).join(', ');\n this.logger.log(`created beans: ${createdBeanNames}`);\n }\n // tslint:disable-next-line\n createBeanWrapper(BeanClass) {\n const metaData = BeanClass.__agBeanMetaData;\n if (!metaData) {\n let beanName;\n if (BeanClass.prototype.constructor) {\n beanName = getFunctionName(BeanClass.prototype.constructor);\n }\n else {\n beanName = \"\" + BeanClass;\n }\n console.error(`Context item ${beanName} is not a bean`);\n return;\n }\n const beanEntry = {\n bean: BeanClass,\n beanInstance: null,\n beanName: metaData.beanName\n };\n this.beanWrappers[metaData.beanName] = beanEntry;\n }\n autoWireBeans(beanInstances) {\n beanInstances.forEach(beanInstance => {\n this.forEachMetaDataInHierarchy(beanInstance, (metaData, beanName) => {\n const attributes = metaData.agClassAttributes;\n if (!attributes) {\n return;\n }\n attributes.forEach((attribute) => {\n const otherBean = this.lookupBeanInstance(beanName, attribute.beanName, attribute.optional);\n beanInstance[attribute.attributeName] = otherBean;\n });\n });\n });\n }\n methodWireBeans(beanInstances) {\n beanInstances.forEach(beanInstance => {\n this.forEachMetaDataInHierarchy(beanInstance, (metaData, beanName) => {\n iterateObject(metaData.autowireMethods, (methodName, wireParams) => {\n // skip constructor, as this is dealt with elsewhere\n if (methodName === \"agConstructor\") {\n return;\n }\n const initParams = this.getBeansForParameters(wireParams, beanName);\n beanInstance[methodName].apply(beanInstance, initParams);\n });\n });\n });\n }\n forEachMetaDataInHierarchy(beanInstance, callback) {\n let prototype = Object.getPrototypeOf(beanInstance);\n while (prototype != null) {\n const constructor = prototype.constructor;\n if (constructor.hasOwnProperty('__agBeanMetaData')) {\n const metaData = constructor.__agBeanMetaData;\n const beanName = this.getBeanName(constructor);\n callback(metaData, beanName);\n }\n prototype = Object.getPrototypeOf(prototype);\n }\n }\n getBeanName(constructor) {\n if (constructor.__agBeanMetaData && constructor.__agBeanMetaData.beanName) {\n return constructor.__agBeanMetaData.beanName;\n }\n const constructorString = constructor.toString();\n const beanName = constructorString.substring(9, constructorString.indexOf(\"(\"));\n return beanName;\n }\n getBeansForParameters(parameters, beanName) {\n const beansList = [];\n if (parameters) {\n iterateObject(parameters, (paramIndex, otherBeanName) => {\n const otherBean = this.lookupBeanInstance(beanName, otherBeanName);\n beansList[Number(paramIndex)] = otherBean;\n });\n }\n return beansList;\n }\n lookupBeanInstance(wiringBean, beanName, optional = false) {\n if (this.destroyed) {\n this.logger.log(`AG Grid: bean reference ${beanName} is used after the grid is destroyed!`);\n return null;\n }\n if (beanName === \"context\") {\n return this;\n }\n if (this.contextParams.providedBeanInstances && this.contextParams.providedBeanInstances.hasOwnProperty(beanName)) {\n return this.contextParams.providedBeanInstances[beanName];\n }\n const beanEntry = this.beanWrappers[beanName];\n if (beanEntry) {\n return beanEntry.beanInstance;\n }\n if (!optional) {\n console.error(`AG Grid: unable to find bean reference ${beanName} while initialising ${wiringBean}`);\n }\n return null;\n }\n callLifeCycleMethods(beanInstances, lifeCycleMethod) {\n beanInstances.forEach(beanInstance => this.callLifeCycleMethodsOnBean(beanInstance, lifeCycleMethod));\n }\n callLifeCycleMethodsOnBean(beanInstance, lifeCycleMethod, methodToIgnore) {\n // putting all methods into a map removes duplicates\n const allMethods = {};\n // dump methods from each level of the metadata hierarchy\n this.forEachMetaDataInHierarchy(beanInstance, (metaData) => {\n const methods = metaData[lifeCycleMethod];\n if (methods) {\n methods.forEach(methodName => {\n if (methodName != methodToIgnore) {\n allMethods[methodName] = true;\n }\n });\n }\n });\n const allMethodsList = Object.keys(allMethods);\n allMethodsList.forEach(methodName => beanInstance[methodName]());\n }\n getBean(name) {\n return this.lookupBeanInstance(\"getBean\", name, true);\n }\n destroy() {\n if (this.destroyed) {\n return;\n }\n // Set before doing the destroy, so if context.destroy() gets called via another bean\n // we are marked as destroyed already to prevent running destroy() twice\n this.destroyed = true;\n this.logger.log(\">> Shutting down ag-Application Context\");\n const beanInstances = this.getBeanInstances();\n this.destroyBeans(beanInstances);\n this.contextParams.providedBeanInstances = null;\n ModuleRegistry.__unRegisterGridModules(this.contextParams.gridId);\n this.logger.log(\">> ag-Application Context shut down - component is dead\");\n }\n destroyBean(bean) {\n if (!bean) {\n return;\n }\n this.destroyBeans([bean]);\n }\n destroyBeans(beans) {\n if (!beans) {\n return [];\n }\n beans.forEach(bean => {\n this.callLifeCycleMethodsOnBean(bean, 'preDestroyMethods', 'destroy');\n // call destroy() explicitly if it exists\n const beanAny = bean;\n if (typeof beanAny.destroy === 'function') {\n beanAny.destroy();\n }\n });\n return [];\n }\n isDestroyed() {\n return this.destroyed;\n }\n getGridId() {\n return this.contextParams.gridId;\n }\n}\nexport function PreConstruct(target, methodName, descriptor) {\n const props = getOrCreateProps(target.constructor);\n if (!props.preConstructMethods) {\n props.preConstructMethods = [];\n }\n props.preConstructMethods.push(methodName);\n}\nexport function PostConstruct(target, methodName, descriptor) {\n const props = getOrCreateProps(target.constructor);\n if (!props.postConstructMethods) {\n props.postConstructMethods = [];\n }\n props.postConstructMethods.push(methodName);\n}\nexport function PreDestroy(target, methodName, descriptor) {\n const props = getOrCreateProps(target.constructor);\n if (!props.preDestroyMethods) {\n props.preDestroyMethods = [];\n }\n props.preDestroyMethods.push(methodName);\n}\nexport function Bean(beanName) {\n return (classConstructor) => {\n const props = getOrCreateProps(classConstructor);\n props.beanName = beanName;\n };\n}\nexport function Autowired(name) {\n return (target, propertyKey, descriptor) => {\n autowiredFunc(target, name, false, target, propertyKey, null);\n };\n}\nexport function Optional(name) {\n return (target, propertyKey, descriptor) => {\n autowiredFunc(target, name, true, target, propertyKey, null);\n };\n}\nfunction autowiredFunc(target, name, optional, classPrototype, methodOrAttributeName, index) {\n if (name === null) {\n console.error(\"AG Grid: Autowired name should not be null\");\n return;\n }\n if (typeof index === \"number\") {\n console.error(\"AG Grid: Autowired should be on an attribute\");\n return;\n }\n // it's an attribute on the class\n const props = getOrCreateProps(target.constructor);\n if (!props.agClassAttributes) {\n props.agClassAttributes = [];\n }\n props.agClassAttributes.push({\n attributeName: methodOrAttributeName,\n beanName: name,\n optional: optional\n });\n}\nexport function Qualifier(name) {\n return (classPrototype, methodOrAttributeName, index) => {\n const constructor = typeof classPrototype == \"function\" ? classPrototype : classPrototype.constructor;\n let props;\n if (typeof index === \"number\") {\n // it's a parameter on a method\n let methodName;\n if (methodOrAttributeName) {\n props = getOrCreateProps(constructor);\n methodName = methodOrAttributeName;\n }\n else {\n props = getOrCreateProps(constructor);\n methodName = \"agConstructor\";\n }\n if (!props.autowireMethods) {\n props.autowireMethods = {};\n }\n if (!props.autowireMethods[methodName]) {\n props.autowireMethods[methodName] = {};\n }\n props.autowireMethods[methodName][index] = name;\n }\n };\n}\nfunction getOrCreateProps(target) {\n if (!target.hasOwnProperty(\"__agBeanMetaData\")) {\n target.__agBeanMetaData = {};\n }\n return target.__agBeanMetaData;\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { Bean, Qualifier } from \"./context/context.mjs\";\nlet EventService = class EventService {\n constructor() {\n this.allSyncListeners = new Map();\n this.allAsyncListeners = new Map();\n this.globalSyncListeners = new Set();\n this.globalAsyncListeners = new Set();\n this.asyncFunctionsQueue = [];\n this.scheduled = false;\n // using an object performs better than a Set for the number of different events we have\n this.firedEvents = {};\n }\n // because this class is used both inside the context and outside the context, we do not\n // use autowired attributes, as that would be confusing, as sometimes the attributes\n // would be wired, and sometimes not.\n //\n // the global event servers used by AG Grid is autowired by the context once, and this\n // setBeans method gets called once.\n //\n // the times when this class is used outside of the context (eg RowNode has an instance of this\n // class) then it is not a bean, and this setBeans method is not called.\n setBeans(loggerFactory, gridOptionsService, frameworkOverrides, globalEventListener = null) {\n this.frameworkOverrides = frameworkOverrides;\n this.gridOptionsService = gridOptionsService;\n if (globalEventListener) {\n const async = gridOptionsService.useAsyncEvents();\n this.addGlobalListener(globalEventListener, async);\n }\n }\n getListeners(eventType, async, autoCreateListenerCollection) {\n const listenerMap = async ? this.allAsyncListeners : this.allSyncListeners;\n let listeners = listenerMap.get(eventType);\n // Note: 'autoCreateListenerCollection' should only be 'true' if a listener is about to be added. For instance\n // getListeners() is also called during event dispatch even though no listeners are added. This measure protects\n // against 'memory bloat' as empty collections will prevent the RowNode's event service from being removed after\n // the RowComp is destroyed, see noRegisteredListenersExist() below.\n if (!listeners && autoCreateListenerCollection) {\n listeners = new Set();\n listenerMap.set(eventType, listeners);\n }\n return listeners;\n }\n noRegisteredListenersExist() {\n return this.allSyncListeners.size === 0 && this.allAsyncListeners.size === 0 &&\n this.globalSyncListeners.size === 0 && this.globalAsyncListeners.size === 0;\n }\n addEventListener(eventType, listener, async = false) {\n this.getListeners(eventType, async, true).add(listener);\n }\n removeEventListener(eventType, listener, async = false) {\n const listeners = this.getListeners(eventType, async, false);\n if (!listeners) {\n return;\n }\n listeners.delete(listener);\n if (listeners.size === 0) {\n const listenerMap = async ? this.allAsyncListeners : this.allSyncListeners;\n listenerMap.delete(eventType);\n }\n }\n addGlobalListener(listener, async = false) {\n (async ? this.globalAsyncListeners : this.globalSyncListeners).add(listener);\n }\n removeGlobalListener(listener, async = false) {\n (async ? this.globalAsyncListeners : this.globalSyncListeners).delete(listener);\n }\n dispatchEvent(event) {\n let agEvent = event;\n if (this.gridOptionsService) {\n // Apply common properties to all dispatched events if this event service has had its beans set with gridOptionsService.\n // Note there are multiple instances of EventService that are used local to components which do not set gridOptionsService.\n const { api, columnApi, context } = this.gridOptionsService;\n agEvent.api = api;\n agEvent.columnApi = columnApi;\n agEvent.context = context;\n }\n this.dispatchToListeners(agEvent, true);\n this.dispatchToListeners(agEvent, false);\n this.firedEvents[agEvent.type] = true;\n }\n dispatchEventOnce(event) {\n if (!this.firedEvents[event.type]) {\n this.dispatchEvent(event);\n }\n }\n dispatchToListeners(event, async) {\n const eventType = event.type;\n if (async && 'event' in event) {\n const browserEvent = event.event;\n if (browserEvent instanceof Event) {\n // AG-7893 - Persist composedPath() so that its result can still be accessed by the user asynchronously.\n // Within an async event handler if they call composedPath() on the event it will always return an empty [].\n event.eventPath = browserEvent.composedPath();\n }\n }\n const processEventListeners = (listeners) => listeners.forEach(listener => {\n if (async) {\n this.dispatchAsync(() => listener(event));\n }\n else {\n listener(event);\n }\n });\n // create a shallow copy to prevent listeners cyclically adding more listeners to capture this event\n const listeners = new Set(this.getListeners(eventType, async, false));\n if (listeners) {\n processEventListeners(listeners);\n }\n const globalListeners = new Set(async ? this.globalAsyncListeners : this.globalSyncListeners);\n globalListeners.forEach(listener => {\n if (async) {\n this.dispatchAsync(() => this.frameworkOverrides.dispatchEvent(eventType, () => listener(eventType, event), true));\n }\n else {\n this.frameworkOverrides.dispatchEvent(eventType, () => listener(eventType, event), true);\n }\n });\n }\n // this gets called inside the grid's thread, for each event that it\n // wants to set async. the grid then batches the events into one setTimeout()\n // because setTimeout() is an expensive operation. ideally we would have\n // each event in it's own setTimeout(), but we batch for performance.\n dispatchAsync(func) {\n // add to the queue for executing later in the next VM turn\n this.asyncFunctionsQueue.push(func);\n // check if timeout is already scheduled. the first time the grid calls\n // this within it's thread turn, this should be false, so it will schedule\n // the 'flush queue' method the first time it comes here. then the flag is\n // set to 'true' so it will know it's already scheduled for subsequent calls.\n if (!this.scheduled) {\n // if not scheduled, schedule one\n window.setTimeout(this.flushAsyncQueue.bind(this), 0);\n // mark that it is scheduled\n this.scheduled = true;\n }\n }\n // this happens in the next VM turn only, and empties the queue of events\n flushAsyncQueue() {\n this.scheduled = false;\n // we take a copy, because the event listener could be using\n // the grid, which would cause more events, which would be potentially\n // added to the queue, so safe to take a copy, the new events will\n // get executed in a later VM turn rather than risk updating the\n // queue as we are flushing it.\n const queueCopy = this.asyncFunctionsQueue.slice();\n this.asyncFunctionsQueue = [];\n // execute the queue\n queueCopy.forEach(func => func());\n }\n};\n__decorate([\n __param(0, Qualifier('loggerFactory')),\n __param(1, Qualifier('gridOptionsService')),\n __param(2, Qualifier('frameworkOverrides')),\n __param(3, Qualifier('globalEventListener'))\n], EventService.prototype, \"setBeans\", null);\nEventService = __decorate([\n Bean('eventService')\n], EventService);\nexport { EventService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { EventService } from \"../eventService.mjs\";\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { ModuleNames } from \"../modules/moduleNames.mjs\";\nimport { ModuleRegistry } from \"../modules/moduleRegistry.mjs\";\nimport { attrToNumber, attrToBoolean, exists, missing } from \"../utils/generic.mjs\";\nimport { doOnce } from \"../utils/function.mjs\";\nimport { mergeDeep } from \"../utils/object.mjs\";\nlet instanceIdSequence = 0;\nexport function getNextColInstanceId() {\n return instanceIdSequence++;\n}\n// Wrapper around a user provide column definition. The grid treats the column definition as ready only.\n// This class contains all the runtime information about a column, plus some logic (the definition has no logic).\n// This class implements both interfaces ColumnGroupChild and ProvidedColumnGroupChild as the class can\n// appear as a child of either the original tree or the displayed tree. However the relevant group classes\n// for each type only implements one, as each group can only appear in it's associated tree (eg ProvidedColumnGroup\n// can only appear in OriginalColumn tree).\nexport class Column {\n constructor(colDef, userProvidedColDef, colId, primary) {\n // used by React (and possibly other frameworks) as key for rendering. also used to\n // identify old vs new columns for destroying cols when no longer used.\n this.instanceId = getNextColInstanceId();\n // The measured height of this column's header when autoHeaderHeight is enabled\n this.autoHeaderHeight = null;\n this.moving = false;\n this.menuVisible = false;\n this.lastLeftPinned = false;\n this.firstRightPinned = false;\n this.filterActive = false;\n this.eventService = new EventService();\n this.tooltipEnabled = false;\n this.rowGroupActive = false;\n this.pivotActive = false;\n this.aggregationActive = false;\n this.colDef = colDef;\n this.userProvidedColDef = userProvidedColDef;\n this.colId = colId;\n this.primary = primary;\n this.setState(colDef);\n }\n getInstanceId() {\n return this.instanceId;\n }\n setState(colDef) {\n // sort\n if (colDef.sort !== undefined) {\n if (colDef.sort === 'asc' || colDef.sort === 'desc') {\n this.sort = colDef.sort;\n }\n }\n else {\n if (colDef.initialSort === 'asc' || colDef.initialSort === 'desc') {\n this.sort = colDef.initialSort;\n }\n }\n // sortIndex\n const sortIndex = attrToNumber(colDef.sortIndex);\n const initialSortIndex = attrToNumber(colDef.initialSortIndex);\n if (sortIndex !== undefined) {\n if (sortIndex !== null) {\n this.sortIndex = sortIndex;\n }\n }\n else {\n if (initialSortIndex !== null) {\n this.sortIndex = initialSortIndex;\n }\n }\n // hide\n const hide = attrToBoolean(colDef.hide);\n const initialHide = attrToBoolean(colDef.initialHide);\n if (hide !== undefined) {\n this.visible = !hide;\n }\n else {\n this.visible = !initialHide;\n }\n // pinned\n if (colDef.pinned !== undefined) {\n this.setPinned(colDef.pinned);\n }\n else {\n this.setPinned(colDef.initialPinned);\n }\n // flex\n const flex = attrToNumber(colDef.flex);\n const initialFlex = attrToNumber(colDef.initialFlex);\n if (flex !== undefined) {\n this.flex = flex;\n }\n else if (initialFlex !== undefined) {\n this.flex = initialFlex;\n }\n }\n // gets called when user provides an alternative colDef, eg\n setColDef(colDef, userProvidedColDef) {\n this.colDef = colDef;\n this.userProvidedColDef = userProvidedColDef;\n this.initMinAndMaxWidths();\n this.initDotNotation();\n this.eventService.dispatchEvent(this.createColumnEvent('colDefChanged', \"api\"));\n }\n /**\n * Returns the column definition provided by the application.\n * This may not be correct, as items can be superseded by default column options.\n * However it's useful for comparison, eg to know which application column definition matches that column.\n */\n getUserProvidedColDef() {\n return this.userProvidedColDef;\n }\n setParent(parent) {\n this.parent = parent;\n }\n /** Returns the parent column group, if column grouping is active. */\n getParent() {\n return this.parent;\n }\n setOriginalParent(originalParent) {\n this.originalParent = originalParent;\n }\n /**\n * Used for marryChildren, helps with comparing when duplicate groups have been created to manage split groups.\n *\n * Parent may contain a duplicate but not identical group when the group is split.\n */\n getOriginalParent() {\n return this.originalParent;\n }\n // this is done after constructor as it uses gridOptionsService\n initialise() {\n this.initMinAndMaxWidths();\n this.resetActualWidth('gridInitializing');\n this.initDotNotation();\n this.initTooltip();\n this.validate();\n }\n initDotNotation() {\n const suppressDotNotation = this.gridOptionsService.is('suppressFieldDotNotation');\n this.fieldContainsDots = exists(this.colDef.field) && this.colDef.field.indexOf('.') >= 0 && !suppressDotNotation;\n this.tooltipFieldContainsDots = exists(this.colDef.tooltipField) && this.colDef.tooltipField.indexOf('.') >= 0 && !suppressDotNotation;\n }\n initMinAndMaxWidths() {\n const colDef = this.colDef;\n this.minWidth = this.columnUtils.calculateColMinWidth(colDef);\n this.maxWidth = this.columnUtils.calculateColMaxWidth(colDef);\n }\n initTooltip() {\n this.tooltipEnabled = exists(this.colDef.tooltipField) ||\n exists(this.colDef.tooltipValueGetter) ||\n exists(this.colDef.tooltipComponent);\n }\n resetActualWidth(source = 'api') {\n const initialWidth = this.columnUtils.calculateColInitialWidth(this.colDef);\n this.setActualWidth(initialWidth, source, true);\n }\n isEmptyGroup() {\n return false;\n }\n isRowGroupDisplayed(colId) {\n if (missing(this.colDef) || missing(this.colDef.showRowGroup)) {\n return false;\n }\n const showingAllGroups = this.colDef.showRowGroup === true;\n const showingThisGroup = this.colDef.showRowGroup === colId;\n return showingAllGroups || showingThisGroup;\n }\n /** Returns `true` if column is a primary column, `false` if secondary. Secondary columns are used for pivoting. */\n isPrimary() {\n return this.primary;\n }\n /** Returns `true` if column filtering is allowed. */\n isFilterAllowed() {\n // filter defined means it's a string, class or true.\n // if its false, null or undefined then it's false.\n const filterDefined = !!this.colDef.filter;\n return filterDefined;\n }\n isFieldContainsDots() {\n return this.fieldContainsDots;\n }\n isTooltipEnabled() {\n return this.tooltipEnabled;\n }\n isTooltipFieldContainsDots() {\n return this.tooltipFieldContainsDots;\n }\n validate() {\n const colDefAny = this.colDef;\n function warnOnce(msg, key, obj) {\n doOnce(() => {\n if (obj) {\n console.warn(msg, obj);\n }\n else {\n doOnce(() => console.warn(msg), key);\n }\n }, key);\n }\n const usingCSRM = this.gridOptionsService.isRowModelType('clientSide');\n if (usingCSRM && !ModuleRegistry.__isRegistered(ModuleNames.RowGroupingModule, this.gridOptionsService.getGridId())) {\n const rowGroupingItems = ['enableRowGroup', 'rowGroup', 'rowGroupIndex', 'enablePivot', 'enableValue', 'pivot', 'pivotIndex', 'aggFunc'];\n const itemsUsed = rowGroupingItems.filter(x => exists(colDefAny[x]));\n if (itemsUsed.length > 0) {\n ModuleRegistry.__assertRegistered(ModuleNames.RowGroupingModule, itemsUsed.map(i => 'colDef.' + i).join(', '), this.gridOptionsService.getGridId());\n }\n }\n if (this.colDef.cellEditor === 'agRichSelect' || this.colDef.cellEditor === 'agRichSelectCellEditor') {\n ModuleRegistry.__assertRegistered(ModuleNames.RichSelectModule, this.colDef.cellEditor, this.gridOptionsService.getGridId());\n }\n if (this.gridOptionsService.isTreeData()) {\n const itemsNotAllowedWithTreeData = ['rowGroup', 'rowGroupIndex', 'pivot', 'pivotIndex'];\n const itemsUsed = itemsNotAllowedWithTreeData.filter(x => exists(colDefAny[x]));\n if (itemsUsed.length > 0) {\n warnOnce(`AG Grid: ${itemsUsed.join()} is not possible when doing tree data, your column definition should not have ${itemsUsed.join()}`, 'TreeDataCannotRowGroup');\n }\n }\n if (exists(colDefAny.menuTabs)) {\n if (Array.isArray(colDefAny.menuTabs)) {\n const communityMenuTabs = ['filterMenuTab'];\n const enterpriseMenuTabs = ['columnsMenuTab', 'generalMenuTab'];\n const itemsUsed = enterpriseMenuTabs.filter(x => colDefAny.menuTabs.includes(x));\n if (itemsUsed.length > 0) {\n ModuleRegistry.__assertRegistered(ModuleNames.MenuModule, `menuTab(s): ${itemsUsed.map(t => `'${t}'`).join()}`, this.gridOptionsService.getGridId());\n }\n colDefAny.menuTabs.forEach((tab) => {\n if (!enterpriseMenuTabs.includes(tab) && !communityMenuTabs.includes(tab)) {\n warnOnce(`AG Grid: '${tab}' is not valid for 'colDef.menuTabs'. Valid values are: ${[...communityMenuTabs, ...enterpriseMenuTabs].map(t => `'${t}'`).join()}.`, 'wrongValue_menuTabs_' + tab);\n }\n });\n }\n else {\n warnOnce(`AG Grid: The typeof 'colDef.menuTabs' should be an array not:` + typeof colDefAny.menuTabs, 'wrongType_menuTabs');\n }\n }\n if (exists(colDefAny.columnsMenuParams)) {\n ModuleRegistry.__assertRegistered(ModuleNames.MenuModule, 'columnsMenuParams', this.gridOptionsService.getGridId());\n }\n if (exists(colDefAny.columnsMenuParams)) {\n ModuleRegistry.__assertRegistered(ModuleNames.ColumnsToolPanelModule, 'columnsMenuParams', this.gridOptionsService.getGridId());\n }\n if (exists(this.colDef.width) && typeof this.colDef.width !== 'number') {\n warnOnce('AG Grid: colDef.width should be a number, not ' + typeof this.colDef.width, 'ColumnCheck');\n }\n if (exists(colDefAny.columnGroupShow) && colDefAny.columnGroupShow !== 'closed' && colDefAny.columnGroupShow !== 'open') {\n warnOnce(`AG Grid: '${colDefAny.columnGroupShow}' is not valid for columnGroupShow. Valid values are 'open', 'closed', undefined, null`, 'columnGroupShow_invalid');\n }\n }\n /** Add an event listener to the column. */\n addEventListener(eventType, listener) {\n this.eventService.addEventListener(eventType, listener);\n }\n /** Remove event listener from the column. */\n removeEventListener(eventType, listener) {\n this.eventService.removeEventListener(eventType, listener);\n }\n createColumnFunctionCallbackParams(rowNode) {\n return {\n node: rowNode,\n data: rowNode.data,\n column: this,\n colDef: this.colDef,\n context: this.gridOptionsService.context,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi\n };\n }\n isSuppressNavigable(rowNode) {\n // if boolean set, then just use it\n if (typeof this.colDef.suppressNavigable === 'boolean') {\n return this.colDef.suppressNavigable;\n }\n // if function, then call the function to find out\n if (typeof this.colDef.suppressNavigable === 'function') {\n const params = this.createColumnFunctionCallbackParams(rowNode);\n const userFunc = this.colDef.suppressNavigable;\n return userFunc(params);\n }\n return false;\n }\n /**\n * Returns `true` if the cell for this column is editable for the given `rowNode`, otherwise `false`.\n */\n isCellEditable(rowNode) {\n // only allow editing of groups if the user has this option enabled\n if (rowNode.group && !this.gridOptionsService.is('enableGroupEdit')) {\n return false;\n }\n return this.isColumnFunc(rowNode, this.colDef.editable);\n }\n isSuppressFillHandle() {\n return !!attrToBoolean(this.colDef.suppressFillHandle);\n }\n isAutoHeight() {\n return !!attrToBoolean(this.colDef.autoHeight);\n }\n isAutoHeaderHeight() {\n return !!attrToBoolean(this.colDef.autoHeaderHeight);\n }\n isRowDrag(rowNode) {\n return this.isColumnFunc(rowNode, this.colDef.rowDrag);\n }\n isDndSource(rowNode) {\n return this.isColumnFunc(rowNode, this.colDef.dndSource);\n }\n isCellCheckboxSelection(rowNode) {\n return this.isColumnFunc(rowNode, this.colDef.checkboxSelection);\n }\n isSuppressPaste(rowNode) {\n return this.isColumnFunc(rowNode, this.colDef ? this.colDef.suppressPaste : null);\n }\n isResizable() {\n return !!attrToBoolean(this.colDef.resizable);\n }\n isColumnFunc(rowNode, value) {\n // if boolean set, then just use it\n if (typeof value === 'boolean') {\n return value;\n }\n // if function, then call the function to find out\n if (typeof value === 'function') {\n const params = this.createColumnFunctionCallbackParams(rowNode);\n const editableFunc = value;\n return editableFunc(params);\n }\n return false;\n }\n setMoving(moving, source = \"api\") {\n this.moving = moving;\n this.eventService.dispatchEvent(this.createColumnEvent('movingChanged', source));\n }\n createColumnEvent(type, source) {\n return {\n type: type,\n column: this,\n columns: [this],\n source: source,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context\n };\n }\n isMoving() {\n return this.moving;\n }\n /** If sorting is active, returns the sort direction e.g. `'asc'` or `'desc'`. */\n getSort() {\n return this.sort;\n }\n setSort(sort, source = \"api\") {\n if (this.sort !== sort) {\n this.sort = sort;\n this.eventService.dispatchEvent(this.createColumnEvent('sortChanged', source));\n }\n this.dispatchStateUpdatedEvent('sort');\n }\n setMenuVisible(visible, source = \"api\") {\n if (this.menuVisible !== visible) {\n this.menuVisible = visible;\n this.eventService.dispatchEvent(this.createColumnEvent('menuVisibleChanged', source));\n }\n }\n isMenuVisible() {\n return this.menuVisible;\n }\n isSortAscending() {\n return this.sort === 'asc';\n }\n isSortDescending() {\n return this.sort === 'desc';\n }\n isSortNone() {\n return missing(this.sort);\n }\n isSorting() {\n return exists(this.sort);\n }\n getSortIndex() {\n return this.sortIndex;\n }\n setSortIndex(sortOrder) {\n this.sortIndex = sortOrder;\n this.dispatchStateUpdatedEvent('sortIndex');\n }\n setAggFunc(aggFunc) {\n this.aggFunc = aggFunc;\n this.dispatchStateUpdatedEvent('aggFunc');\n }\n /** If aggregation is set for the column, returns the aggregation function. */\n getAggFunc() {\n return this.aggFunc;\n }\n getLeft() {\n return this.left;\n }\n getOldLeft() {\n return this.oldLeft;\n }\n getRight() {\n return this.left + this.actualWidth;\n }\n setLeft(left, source = \"api\") {\n this.oldLeft = this.left;\n if (this.left !== left) {\n this.left = left;\n this.eventService.dispatchEvent(this.createColumnEvent('leftChanged', source));\n }\n }\n /** Returns `true` if filter is active on the column. */\n isFilterActive() {\n return this.filterActive;\n }\n // additionalEventAttributes is used by provided simple floating filter, so it can add 'floatingFilter=true' to the event\n setFilterActive(active, source = \"api\", additionalEventAttributes) {\n if (this.filterActive !== active) {\n this.filterActive = active;\n this.eventService.dispatchEvent(this.createColumnEvent('filterActiveChanged', source));\n }\n const filterChangedEvent = this.createColumnEvent('filterChanged', source);\n if (additionalEventAttributes) {\n mergeDeep(filterChangedEvent, additionalEventAttributes);\n }\n this.eventService.dispatchEvent(filterChangedEvent);\n }\n /** Returns `true` when this `Column` is hovered, otherwise `false` */\n isHovered() {\n return this.columnHoverService.isHovered(this);\n }\n setPinned(pinned) {\n if (pinned === true || pinned === 'left') {\n this.pinned = 'left';\n }\n else if (pinned === 'right') {\n this.pinned = 'right';\n }\n else {\n this.pinned = null;\n }\n this.dispatchStateUpdatedEvent('pinned');\n }\n setFirstRightPinned(firstRightPinned, source = \"api\") {\n if (this.firstRightPinned !== firstRightPinned) {\n this.firstRightPinned = firstRightPinned;\n this.eventService.dispatchEvent(this.createColumnEvent('firstRightPinnedChanged', source));\n }\n }\n setLastLeftPinned(lastLeftPinned, source = \"api\") {\n if (this.lastLeftPinned !== lastLeftPinned) {\n this.lastLeftPinned = lastLeftPinned;\n this.eventService.dispatchEvent(this.createColumnEvent('lastLeftPinnedChanged', source));\n }\n }\n isFirstRightPinned() {\n return this.firstRightPinned;\n }\n isLastLeftPinned() {\n return this.lastLeftPinned;\n }\n isPinned() {\n return this.pinned === 'left' || this.pinned === 'right';\n }\n isPinnedLeft() {\n return this.pinned === 'left';\n }\n isPinnedRight() {\n return this.pinned === 'right';\n }\n getPinned() {\n return this.pinned;\n }\n setVisible(visible, source = \"api\") {\n const newValue = visible === true;\n if (this.visible !== newValue) {\n this.visible = newValue;\n this.eventService.dispatchEvent(this.createColumnEvent('visibleChanged', source));\n }\n this.dispatchStateUpdatedEvent('hide');\n }\n isVisible() {\n return this.visible;\n }\n isSpanHeaderHeight() {\n const colDef = this.getColDef();\n return !colDef.suppressSpanHeaderHeight && !colDef.autoHeaderHeight;\n }\n /** Returns the column definition for this column.\n * The column definition will be the result of merging the application provided column definition with any provided defaults\n * (e.g. `defaultColDef` grid option, or column types.\n *\n * Equivalent: `getDefinition` */\n getColDef() {\n return this.colDef;\n }\n getColumnGroupShow() {\n return this.colDef.columnGroupShow;\n }\n /**\n * Returns the unique ID for the column.\n *\n * Equivalent: `getId`, `getUniqueId` */\n getColId() {\n return this.colId;\n }\n /**\n * Returns the unique ID for the column.\n *\n * Equivalent: `getColId`, `getUniqueId` */\n getId() {\n return this.colId;\n }\n /**\n * Returns the unique ID for the column.\n *\n * Equivalent: `getColId`, `getId` */\n getUniqueId() {\n return this.colId;\n }\n getDefinition() {\n return this.colDef;\n }\n /** Returns the current width of the column. If the column is resized, the actual width is the new size. */\n getActualWidth() {\n return this.actualWidth;\n }\n getAutoHeaderHeight() {\n return this.autoHeaderHeight;\n }\n /** Returns true if the header height has changed */\n setAutoHeaderHeight(height) {\n const changed = height !== this.autoHeaderHeight;\n this.autoHeaderHeight = height;\n return changed;\n }\n createBaseColDefParams(rowNode) {\n const params = {\n node: rowNode,\n data: rowNode.data,\n colDef: this.colDef,\n column: this,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context\n };\n return params;\n }\n getColSpan(rowNode) {\n if (missing(this.colDef.colSpan)) {\n return 1;\n }\n const params = this.createBaseColDefParams(rowNode);\n const colSpan = this.colDef.colSpan(params);\n // colSpan must be number equal to or greater than 1\n return Math.max(colSpan, 1);\n }\n getRowSpan(rowNode) {\n if (missing(this.colDef.rowSpan)) {\n return 1;\n }\n const params = this.createBaseColDefParams(rowNode);\n const rowSpan = this.colDef.rowSpan(params);\n // rowSpan must be number equal to or greater than 1\n return Math.max(rowSpan, 1);\n }\n setActualWidth(actualWidth, source = \"api\", silent = false) {\n if (this.minWidth != null) {\n actualWidth = Math.max(actualWidth, this.minWidth);\n }\n if (this.maxWidth != null) {\n actualWidth = Math.min(actualWidth, this.maxWidth);\n }\n if (this.actualWidth !== actualWidth) {\n // disable flex for this column if it was manually resized.\n this.actualWidth = actualWidth;\n if (this.flex && source !== 'flex' && source !== 'gridInitializing') {\n this.flex = null;\n }\n if (!silent) {\n this.fireColumnWidthChangedEvent(source);\n }\n }\n this.dispatchStateUpdatedEvent('width');\n }\n fireColumnWidthChangedEvent(source) {\n this.eventService.dispatchEvent(this.createColumnEvent('widthChanged', source));\n }\n isGreaterThanMax(width) {\n if (this.maxWidth != null) {\n return width > this.maxWidth;\n }\n return false;\n }\n getMinWidth() {\n return this.minWidth;\n }\n getMaxWidth() {\n return this.maxWidth;\n }\n getFlex() {\n return this.flex || 0;\n }\n // this method should only be used by the columnModel to\n // change flex when required by the applyColumnState method.\n setFlex(flex) {\n if (this.flex !== flex) {\n this.flex = flex;\n }\n this.dispatchStateUpdatedEvent('flex');\n }\n setMinimum(source = \"api\") {\n if (exists(this.minWidth)) {\n this.setActualWidth(this.minWidth, source);\n }\n }\n setRowGroupActive(rowGroup, source = \"api\") {\n if (this.rowGroupActive !== rowGroup) {\n this.rowGroupActive = rowGroup;\n this.eventService.dispatchEvent(this.createColumnEvent('columnRowGroupChanged', source));\n }\n this.dispatchStateUpdatedEvent('rowGroup');\n }\n /** Returns `true` if row group is currently active for this column. */\n isRowGroupActive() {\n return this.rowGroupActive;\n }\n setPivotActive(pivot, source = \"api\") {\n if (this.pivotActive !== pivot) {\n this.pivotActive = pivot;\n this.eventService.dispatchEvent(this.createColumnEvent('columnPivotChanged', source));\n }\n this.dispatchStateUpdatedEvent('pivot');\n }\n /** Returns `true` if pivot is currently active for this column. */\n isPivotActive() {\n return this.pivotActive;\n }\n isAnyFunctionActive() {\n return this.isPivotActive() || this.isRowGroupActive() || this.isValueActive();\n }\n isAnyFunctionAllowed() {\n return this.isAllowPivot() || this.isAllowRowGroup() || this.isAllowValue();\n }\n setValueActive(value, source = \"api\") {\n if (this.aggregationActive !== value) {\n this.aggregationActive = value;\n this.eventService.dispatchEvent(this.createColumnEvent('columnValueChanged', source));\n }\n }\n /** Returns `true` if value (aggregation) is currently active for this column. */\n isValueActive() {\n return this.aggregationActive;\n }\n isAllowPivot() {\n return this.colDef.enablePivot === true;\n }\n isAllowValue() {\n return this.colDef.enableValue === true;\n }\n isAllowRowGroup() {\n return this.colDef.enableRowGroup === true;\n }\n getMenuTabs(defaultValues) {\n let menuTabs = this.getColDef().menuTabs;\n if (menuTabs == null) {\n menuTabs = defaultValues;\n }\n return menuTabs;\n }\n dispatchStateUpdatedEvent(key) {\n this.eventService.dispatchEvent({\n type: Column.EVENT_STATE_UPDATED,\n key\n });\n }\n}\n// + renderedHeaderCell - for making header cell transparent when moving\nColumn.EVENT_MOVING_CHANGED = 'movingChanged';\n// + renderedCell - changing left position\nColumn.EVENT_LEFT_CHANGED = 'leftChanged';\n// + renderedCell - changing width\nColumn.EVENT_WIDTH_CHANGED = 'widthChanged';\n// + renderedCell - for changing pinned classes\nColumn.EVENT_LAST_LEFT_PINNED_CHANGED = 'lastLeftPinnedChanged';\nColumn.EVENT_FIRST_RIGHT_PINNED_CHANGED = 'firstRightPinnedChanged';\n// + renderedColumn - for changing visibility icon\nColumn.EVENT_VISIBLE_CHANGED = 'visibleChanged';\n// + every time the filter changes, used in the floating filters\nColumn.EVENT_FILTER_CHANGED = 'filterChanged';\n// + renderedHeaderCell - marks the header with filter icon\nColumn.EVENT_FILTER_ACTIVE_CHANGED = 'filterActiveChanged';\n// + renderedHeaderCell - marks the header with sort icon\nColumn.EVENT_SORT_CHANGED = 'sortChanged';\n// + renderedHeaderCell - marks the header with sort icon\nColumn.EVENT_COL_DEF_CHANGED = 'colDefChanged';\nColumn.EVENT_MENU_VISIBLE_CHANGED = 'menuVisibleChanged';\n// + toolpanel, for gui updates\nColumn.EVENT_ROW_GROUP_CHANGED = 'columnRowGroupChanged';\n// + toolpanel, for gui updates\nColumn.EVENT_PIVOT_CHANGED = 'columnPivotChanged';\n// + toolpanel, for gui updates\nColumn.EVENT_VALUE_CHANGED = 'columnValueChanged';\n// + dataTypeService - when waiting to infer cell data types\nColumn.EVENT_STATE_UPDATED = 'columnStateUpdated';\n__decorate([\n Autowired('gridOptionsService')\n], Column.prototype, \"gridOptionsService\", void 0);\n__decorate([\n Autowired('columnUtils')\n], Column.prototype, \"columnUtils\", void 0);\n__decorate([\n Autowired('columnHoverService')\n], Column.prototype, \"columnHoverService\", void 0);\n__decorate([\n PostConstruct\n], Column.prototype, \"initialise\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Column, getNextColInstanceId } from \"./column.mjs\";\nimport { EventService } from \"../eventService.mjs\";\nimport { PreDestroy } from \"../context/context.mjs\";\nexport class ProvidedColumnGroup {\n constructor(colGroupDef, groupId, padding, level) {\n this.localEventService = new EventService();\n this.expandable = false;\n // used by React (and possibly other frameworks) as key for rendering. also used to\n // identify old vs new columns for destroying cols when no longer used.\n this.instanceId = getNextColInstanceId();\n this.expandableListenerRemoveCallback = null;\n this.colGroupDef = colGroupDef;\n this.groupId = groupId;\n this.expanded = !!colGroupDef && !!colGroupDef.openByDefault;\n this.padding = padding;\n this.level = level;\n }\n destroy() {\n if (this.expandableListenerRemoveCallback) {\n this.reset(null, undefined);\n }\n }\n reset(colGroupDef, level) {\n this.colGroupDef = colGroupDef;\n this.level = level;\n this.originalParent = null;\n if (this.expandableListenerRemoveCallback) {\n this.expandableListenerRemoveCallback();\n }\n // we use ! below, as we want to set the object back to the\n // way it was when it was first created\n this.children = undefined;\n this.expandable = undefined;\n }\n getInstanceId() {\n return this.instanceId;\n }\n setOriginalParent(originalParent) {\n this.originalParent = originalParent;\n }\n getOriginalParent() {\n return this.originalParent;\n }\n getLevel() {\n return this.level;\n }\n isVisible() {\n // return true if at least one child is visible\n if (this.children) {\n return this.children.some(child => child.isVisible());\n }\n return false;\n }\n isPadding() {\n return this.padding;\n }\n setExpanded(expanded) {\n this.expanded = expanded === undefined ? false : expanded;\n const event = {\n type: ProvidedColumnGroup.EVENT_EXPANDED_CHANGED\n };\n this.localEventService.dispatchEvent(event);\n }\n isExpandable() {\n return this.expandable;\n }\n isExpanded() {\n return this.expanded;\n }\n getGroupId() {\n return this.groupId;\n }\n getId() {\n return this.getGroupId();\n }\n setChildren(children) {\n this.children = children;\n }\n getChildren() {\n return this.children;\n }\n getColGroupDef() {\n return this.colGroupDef;\n }\n getLeafColumns() {\n const result = [];\n this.addLeafColumns(result);\n return result;\n }\n addLeafColumns(leafColumns) {\n if (!this.children) {\n return;\n }\n this.children.forEach((child) => {\n if (child instanceof Column) {\n leafColumns.push(child);\n }\n else if (child instanceof ProvidedColumnGroup) {\n child.addLeafColumns(leafColumns);\n }\n });\n }\n getColumnGroupShow() {\n const colGroupDef = this.colGroupDef;\n if (!colGroupDef) {\n return;\n }\n return colGroupDef.columnGroupShow;\n }\n // need to check that this group has at least one col showing when both expanded and contracted.\n // if not, then we don't allow expanding and contracting on this group\n setupExpandable() {\n this.setExpandable();\n if (this.expandableListenerRemoveCallback) {\n this.expandableListenerRemoveCallback();\n }\n const listener = this.onColumnVisibilityChanged.bind(this);\n this.getLeafColumns().forEach(col => col.addEventListener('visibleChanged', listener));\n this.expandableListenerRemoveCallback = () => {\n this.getLeafColumns().forEach(col => col.removeEventListener('visibleChanged', listener));\n this.expandableListenerRemoveCallback = null;\n };\n }\n setExpandable() {\n if (this.isPadding()) {\n return;\n }\n // want to make sure the group doesn't disappear when it's open\n let atLeastOneShowingWhenOpen = false;\n // want to make sure the group doesn't disappear when it's closed\n let atLeastOneShowingWhenClosed = false;\n // want to make sure the group has something to show / hide\n let atLeastOneChangeable = false;\n const children = this.findChildrenRemovingPadding();\n for (let i = 0, j = children.length; i < j; i++) {\n const abstractColumn = children[i];\n if (!abstractColumn.isVisible()) {\n continue;\n }\n // if the abstractColumn is a grid generated group, there will be no colDef\n const headerGroupShow = abstractColumn.getColumnGroupShow();\n if (headerGroupShow === 'open') {\n atLeastOneShowingWhenOpen = true;\n atLeastOneChangeable = true;\n }\n else if (headerGroupShow === 'closed') {\n atLeastOneShowingWhenClosed = true;\n atLeastOneChangeable = true;\n }\n else {\n atLeastOneShowingWhenOpen = true;\n atLeastOneShowingWhenClosed = true;\n }\n }\n const expandable = atLeastOneShowingWhenOpen && atLeastOneShowingWhenClosed && atLeastOneChangeable;\n if (this.expandable !== expandable) {\n this.expandable = expandable;\n const event = {\n type: ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED\n };\n this.localEventService.dispatchEvent(event);\n }\n }\n findChildrenRemovingPadding() {\n const res = [];\n const process = (items) => {\n items.forEach(item => {\n // if padding, we add this children instead of the padding\n const skipBecausePadding = item instanceof ProvidedColumnGroup && item.isPadding();\n if (skipBecausePadding) {\n process(item.children);\n }\n else {\n res.push(item);\n }\n });\n };\n process(this.children);\n return res;\n }\n onColumnVisibilityChanged() {\n this.setExpandable();\n }\n addEventListener(eventType, listener) {\n this.localEventService.addEventListener(eventType, listener);\n }\n removeEventListener(eventType, listener) {\n this.localEventService.removeEventListener(eventType, listener);\n }\n}\nProvidedColumnGroup.EVENT_EXPANDED_CHANGED = 'expandedChanged';\nProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED = 'expandableChanged';\n__decorate([\n PreDestroy\n], ProvidedColumnGroup.prototype, \"destroy\", null);\n","export const DefaultColumnTypes = {\n numericColumn: {\n headerClass: 'ag-right-aligned-header',\n cellClass: 'ag-right-aligned-cell'\n },\n rightAligned: {\n headerClass: 'ag-right-aligned-header',\n cellClass: 'ag-right-aligned-cell'\n }\n};\n","import { exists, toStringOrNull } from './generic.mjs';\nexport function firstExistingValue(...values) {\n for (let i = 0; i < values.length; i++) {\n const value = values[i];\n if (exists(value)) {\n return value;\n }\n }\n return null;\n}\nexport function existsAndNotEmpty(value) {\n return value != null && value.length > 0;\n}\nexport function last(arr) {\n if (!arr || !arr.length) {\n return;\n }\n return arr[arr.length - 1];\n}\nexport function areEqual(a, b, comparator) {\n if (a == null && b == null) {\n return true;\n }\n return a != null &&\n b != null &&\n a.length === b.length &&\n a.every((value, index) => comparator ? comparator(value, b[index]) : b[index] === value);\n}\n/** @deprecated */\nexport function shallowCompare(arr1, arr2) {\n return areEqual(arr1, arr2);\n}\nexport function sortNumerically(array) {\n return array.sort((a, b) => a - b);\n}\nexport function removeRepeatsFromArray(array, object) {\n if (!array) {\n return;\n }\n for (let index = array.length - 2; index >= 0; index--) {\n const thisOneMatches = array[index] === object;\n const nextOneMatches = array[index + 1] === object;\n if (thisOneMatches && nextOneMatches) {\n array.splice(index + 1, 1);\n }\n }\n}\nexport function removeFromUnorderedArray(array, object) {\n const index = array.indexOf(object);\n if (index >= 0) {\n // preserve the last element, then shorten array length by 1 to delete index\n array[index] = array[array.length - 1];\n array.pop();\n }\n}\nexport function removeFromArray(array, object) {\n const index = array.indexOf(object);\n if (index >= 0) {\n array.splice(index, 1);\n }\n}\nexport function removeAllFromUnorderedArray(array, toRemove) {\n for (let i = 0; i < toRemove.length; i++) {\n removeFromUnorderedArray(array, toRemove[i]);\n }\n}\nexport function removeAllFromArray(array, toRemove) {\n for (let i = 0; i < toRemove.length; i++) {\n removeFromArray(array, toRemove[i]);\n }\n}\nexport function insertIntoArray(array, object, toIndex) {\n array.splice(toIndex, 0, object);\n}\nexport function insertArrayIntoArray(dest, src, toIndex) {\n if (dest == null || src == null) {\n return;\n }\n // put items in backwards, otherwise inserted items end up in reverse order\n for (let i = src.length - 1; i >= 0; i--) {\n const item = src[i];\n insertIntoArray(dest, item, toIndex);\n }\n}\nexport function moveInArray(array, objectsToMove, toIndex) {\n // first take out items from the array\n removeAllFromArray(array, objectsToMove);\n // now add the objects, in same order as provided to us, that means we start at the end\n // as the objects will be pushed to the right as they are inserted\n objectsToMove.slice().reverse().forEach(obj => insertIntoArray(array, obj, toIndex));\n}\nexport function includes(array, value) {\n return array.indexOf(value) > -1;\n}\nexport function flatten(arrayOfArrays) {\n return [].concat.apply([], arrayOfArrays);\n}\nexport function pushAll(target, source) {\n if (source == null || target == null) {\n return;\n }\n source.forEach(value => target.push(value));\n}\nexport function toStrings(array) {\n return array.map(toStringOrNull);\n}\nexport function forEachReverse(list, action) {\n if (list == null) {\n return;\n }\n for (let i = list.length - 1; i >= 0; i--) {\n action(list[i], i);\n }\n}\n","import { includes } from './array.mjs';\nconst AG_GRID_STOP_PROPAGATION = '__ag_Grid_Stop_Propagation';\nconst PASSIVE_EVENTS = ['touchstart', 'touchend', 'touchmove', 'touchcancel', 'scroll'];\nconst supports = {};\n/**\n * a user once raised an issue - they said that when you opened a popup (eg context menu)\n * and then clicked on a selection checkbox, the popup wasn't closed. this is because the\n * popup listens for clicks on the body, however ag-grid WAS stopping propagation on the\n * checkbox clicks (so the rows didn't pick them up as row selection selection clicks).\n * to get around this, we have a pattern to stop propagation for the purposes of AG Grid,\n * but we still let the event pass back to the body.\n * @param {Event} event\n */\nexport function stopPropagationForAgGrid(event) {\n event[AG_GRID_STOP_PROPAGATION] = true;\n}\nexport function isStopPropagationForAgGrid(event) {\n return event[AG_GRID_STOP_PROPAGATION] === true;\n}\nexport const isEventSupported = (() => {\n const tags = {\n select: 'input',\n change: 'input',\n submit: 'form',\n reset: 'form',\n error: 'img',\n load: 'img',\n abort: 'img'\n };\n const eventChecker = (eventName) => {\n if (typeof supports[eventName] === 'boolean') {\n return supports[eventName];\n }\n const el = document.createElement(tags[eventName] || 'div');\n eventName = 'on' + eventName;\n return supports[eventName] = (eventName in el);\n };\n return eventChecker;\n})();\nexport function getCtrlForEventTarget(gridOptionsService, eventTarget, type) {\n let sourceElement = eventTarget;\n while (sourceElement) {\n const renderedComp = gridOptionsService.getDomData(sourceElement, type);\n if (renderedComp) {\n return renderedComp;\n }\n sourceElement = sourceElement.parentElement;\n }\n return null;\n}\nexport function isElementInEventPath(element, event) {\n if (!event || !element) {\n return false;\n }\n return getEventPath(event).indexOf(element) >= 0;\n}\nexport function createEventPath(event) {\n const res = [];\n let pointer = event.target;\n while (pointer) {\n res.push(pointer);\n pointer = pointer.parentElement;\n }\n return res;\n}\n/**\n * Gets the path for a browser Event or from the target on an AG Grid Event\n * https://developer.mozilla.org/en-US/docs/Web/API/Event\n * @param {Event| { target: EventTarget }} event\n * @returns {EventTarget[]}\n */\nexport function getEventPath(event) {\n // This can be called with either a browser event or an AG Grid Event that has a target property.\n const eventNoType = event;\n if (eventNoType.path) {\n return eventNoType.path;\n }\n if (eventNoType.composedPath) {\n return eventNoType.composedPath();\n }\n // If this is an AG Grid event build the path ourselves\n return createEventPath(eventNoType);\n}\nexport function addSafePassiveEventListener(frameworkOverrides, eElement, event, listener) {\n const isPassive = includes(PASSIVE_EVENTS, event);\n const options = isPassive ? { passive: true } : undefined;\n // this check is here for certain scenarios where I believe the user must be destroying\n // the grid somehow but continuing for it to be used\n if (frameworkOverrides && frameworkOverrides.addEventListener) {\n frameworkOverrides.addEventListener(eElement, event, listener, options);\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { EventService } from \"../eventService.mjs\";\nimport { Autowired, PreDestroy } from \"./context.mjs\";\nimport { addSafePassiveEventListener } from \"../utils/event.mjs\";\nexport class BeanStub {\n constructor() {\n this.destroyFunctions = [];\n this.destroyed = false;\n // for vue 3 - prevents Vue from trying to make this (and obviously any sub classes) from being reactive\n // prevents vue from creating proxies for created objects and prevents identity related issues\n this.__v_skip = true;\n this.isAlive = () => !this.destroyed;\n }\n // this was a test constructor niall built, when active, it prints after 5 seconds all beans/components that are\n // not destroyed. to use, create a new grid, then api.destroy() before 5 seconds. then anything that gets printed\n // points to a bean or component that was not properly disposed of.\n // constructor() {\n // setTimeout(()=> {\n // if (this.isAlive()) {\n // let prototype: any = Object.getPrototypeOf(this);\n // const constructor: any = prototype.constructor;\n // const constructorString = constructor.toString();\n // const beanName = constructorString.substring(9, constructorString.indexOf(\"(\"));\n // console.log('is alive ' + beanName);\n // }\n // }, 5000);\n // }\n // CellComp and GridComp and override this because they get the FrameworkOverrides from the Beans bean\n getFrameworkOverrides() {\n return this.frameworkOverrides;\n }\n getContext() {\n return this.context;\n }\n destroy() {\n // let prototype: any = Object.getPrototypeOf(this);\n // const constructor: any = prototype.constructor;\n // const constructorString = constructor.toString();\n // const beanName = constructorString.substring(9, constructorString.indexOf(\"(\"));\n this.destroyFunctions.forEach(func => func());\n this.destroyFunctions.length = 0;\n this.destroyed = true;\n this.dispatchEvent({ type: BeanStub.EVENT_DESTROYED });\n }\n addEventListener(eventType, listener) {\n if (!this.localEventService) {\n this.localEventService = new EventService();\n }\n this.localEventService.addEventListener(eventType, listener);\n }\n removeEventListener(eventType, listener) {\n if (this.localEventService) {\n this.localEventService.removeEventListener(eventType, listener);\n }\n }\n dispatchEventAsync(event) {\n window.setTimeout(() => this.dispatchEvent(event), 0);\n }\n dispatchEvent(event) {\n if (this.localEventService) {\n this.localEventService.dispatchEvent(event);\n }\n }\n addManagedListener(object, event, listener) {\n if (this.destroyed) {\n return;\n }\n if (object instanceof HTMLElement) {\n addSafePassiveEventListener(this.getFrameworkOverrides(), object, event, listener);\n }\n else {\n object.addEventListener(event, listener);\n }\n const destroyFunc = () => {\n object.removeEventListener(event, listener);\n this.destroyFunctions = this.destroyFunctions.filter(fn => fn !== destroyFunc);\n return null;\n };\n this.destroyFunctions.push(destroyFunc);\n return destroyFunc;\n }\n addManagedPropertyListener(event, listener) {\n if (this.destroyed) {\n return;\n }\n this.gridOptionsService.addEventListener(event, listener);\n const destroyFunc = () => {\n this.gridOptionsService.removeEventListener(event, listener);\n this.destroyFunctions = this.destroyFunctions.filter(fn => fn !== destroyFunc);\n return null;\n };\n this.destroyFunctions.push(destroyFunc);\n return destroyFunc;\n }\n addDestroyFunc(func) {\n // if we are already destroyed, we execute the func now\n if (this.isAlive()) {\n this.destroyFunctions.push(func);\n }\n else {\n func();\n }\n }\n createManagedBean(bean, context) {\n const res = this.createBean(bean, context);\n this.addDestroyFunc(this.destroyBean.bind(this, bean, context));\n return res;\n }\n createBean(bean, context, afterPreCreateCallback) {\n return (context || this.getContext()).createBean(bean, afterPreCreateCallback);\n }\n destroyBean(bean, context) {\n return (context || this.getContext()).destroyBean(bean);\n }\n destroyBeans(beans, context) {\n if (beans) {\n beans.forEach(bean => this.destroyBean(bean, context));\n }\n return [];\n }\n}\nBeanStub.EVENT_DESTROYED = 'destroyed';\n__decorate([\n Autowired('frameworkOverrides')\n], BeanStub.prototype, \"frameworkOverrides\", void 0);\n__decorate([\n Autowired('context')\n], BeanStub.prototype, \"context\", void 0);\n__decorate([\n Autowired('eventService')\n], BeanStub.prototype, \"eventService\", void 0);\n__decorate([\n Autowired('gridOptionsService')\n], BeanStub.prototype, \"gridOptionsService\", void 0);\n__decorate([\n Autowired('localeService')\n], BeanStub.prototype, \"localeService\", void 0);\n__decorate([\n Autowired('environment')\n], BeanStub.prototype, \"environment\", void 0);\n__decorate([\n PreDestroy\n], BeanStub.prototype, \"destroy\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { ColumnKeyCreator } from \"./columnKeyCreator.mjs\";\nimport { ProvidedColumnGroup } from \"../entities/providedColumnGroup.mjs\";\nimport { Column } from \"../entities/column.mjs\";\nimport { Autowired, Bean, Qualifier } from \"../context/context.mjs\";\nimport { DefaultColumnTypes } from \"../entities/defaultColumnTypes.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { iterateObject, mergeDeep } from '../utils/object.mjs';\nimport { attrToNumber, attrToBoolean } from '../utils/generic.mjs';\nimport { removeFromArray } from '../utils/array.mjs';\n// takes ColDefs and ColGroupDefs and turns them into Columns and OriginalGroups\nlet ColumnFactory = class ColumnFactory extends BeanStub {\n setBeans(loggerFactory) {\n this.logger = loggerFactory.create('ColumnFactory');\n }\n createColumnTree(defs, primaryColumns, existingTree) {\n // column key creator dishes out unique column id's in a deterministic way,\n // so if we have two grids (that could be master/slave) with same column definitions,\n // then this ensures the two grids use identical id's.\n const columnKeyCreator = new ColumnKeyCreator();\n const { existingCols, existingGroups, existingColKeys } = this.extractExistingTreeData(existingTree);\n columnKeyCreator.addExistingKeys(existingColKeys);\n // create am unbalanced tree that maps the provided definitions\n const unbalancedTree = this.recursivelyCreateColumns(defs, 0, primaryColumns, existingCols, columnKeyCreator, existingGroups);\n const treeDept = this.findMaxDept(unbalancedTree, 0);\n this.logger.log('Number of levels for grouped columns is ' + treeDept);\n const columnTree = this.balanceColumnTree(unbalancedTree, 0, treeDept, columnKeyCreator);\n const deptFirstCallback = (child, parent) => {\n if (child instanceof ProvidedColumnGroup) {\n child.setupExpandable();\n }\n // we set the original parents at the end, rather than when we go along, as balancing the tree\n // adds extra levels into the tree. so we can only set parents when balancing is done.\n child.setOriginalParent(parent);\n };\n this.columnUtils.depthFirstOriginalTreeSearch(null, columnTree, deptFirstCallback);\n return {\n columnTree,\n treeDept\n };\n }\n extractExistingTreeData(existingTree) {\n const existingCols = [];\n const existingGroups = [];\n const existingColKeys = [];\n if (existingTree) {\n this.columnUtils.depthFirstOriginalTreeSearch(null, existingTree, (item) => {\n if (item instanceof ProvidedColumnGroup) {\n const group = item;\n existingGroups.push(group);\n }\n else {\n const col = item;\n existingColKeys.push(col.getId());\n existingCols.push(col);\n }\n });\n }\n return { existingCols, existingGroups, existingColKeys };\n }\n createForAutoGroups(autoGroupCols, gridBalancedTree) {\n return autoGroupCols.map((col) => this.createAutoGroupTreeItem(gridBalancedTree, col));\n }\n createAutoGroupTreeItem(balancedColumnTree, column) {\n const dept = this.findDepth(balancedColumnTree);\n // at the end, this will be the top of the tree item.\n let nextChild = column;\n for (let i = dept - 1; i >= 0; i--) {\n const autoGroup = new ProvidedColumnGroup(null, `FAKE_PATH_${column.getId()}}_${i}`, true, i);\n this.createBean(autoGroup);\n autoGroup.setChildren([nextChild]);\n nextChild.setOriginalParent(autoGroup);\n nextChild = autoGroup;\n }\n if (dept === 0) {\n column.setOriginalParent(null);\n }\n // at this point, the nextChild is the top most item in the tree\n return nextChild;\n }\n findDepth(balancedColumnTree) {\n let dept = 0;\n let pointer = balancedColumnTree;\n while (pointer && pointer[0] && pointer[0] instanceof ProvidedColumnGroup) {\n dept++;\n pointer = pointer[0].getChildren();\n }\n return dept;\n }\n balanceColumnTree(unbalancedTree, currentDept, columnDept, columnKeyCreator) {\n const result = [];\n // go through each child, for groups, recurse a level deeper,\n // for columns we need to pad\n for (let i = 0; i < unbalancedTree.length; i++) {\n const child = unbalancedTree[i];\n if (child instanceof ProvidedColumnGroup) {\n // child is a group, all we do is go to the next level of recursion\n const originalGroup = child;\n const newChildren = this.balanceColumnTree(originalGroup.getChildren(), currentDept + 1, columnDept, columnKeyCreator);\n originalGroup.setChildren(newChildren);\n result.push(originalGroup);\n }\n else {\n // child is a column - so here we add in the padded column groups if needed\n let firstPaddedGroup;\n let currentPaddedGroup;\n // this for loop will NOT run any loops if no padded column groups are needed\n for (let j = columnDept - 1; j >= currentDept; j--) {\n const newColId = columnKeyCreator.getUniqueKey(null, null);\n const colGroupDefMerged = this.createMergedColGroupDef(null);\n const paddedGroup = new ProvidedColumnGroup(colGroupDefMerged, newColId, true, currentDept);\n this.createBean(paddedGroup);\n if (currentPaddedGroup) {\n currentPaddedGroup.setChildren([paddedGroup]);\n }\n currentPaddedGroup = paddedGroup;\n if (!firstPaddedGroup) {\n firstPaddedGroup = currentPaddedGroup;\n }\n }\n // likewise this if statement will not run if no padded groups\n if (firstPaddedGroup && currentPaddedGroup) {\n result.push(firstPaddedGroup);\n const hasGroups = unbalancedTree.some(leaf => leaf instanceof ProvidedColumnGroup);\n if (hasGroups) {\n currentPaddedGroup.setChildren([child]);\n continue;\n }\n else {\n currentPaddedGroup.setChildren(unbalancedTree);\n break;\n }\n }\n result.push(child);\n }\n }\n return result;\n }\n findMaxDept(treeChildren, dept) {\n let maxDeptThisLevel = dept;\n for (let i = 0; i < treeChildren.length; i++) {\n const abstractColumn = treeChildren[i];\n if (abstractColumn instanceof ProvidedColumnGroup) {\n const originalGroup = abstractColumn;\n const newDept = this.findMaxDept(originalGroup.getChildren(), dept + 1);\n if (maxDeptThisLevel < newDept) {\n maxDeptThisLevel = newDept;\n }\n }\n }\n return maxDeptThisLevel;\n }\n recursivelyCreateColumns(defs, level, primaryColumns, existingColsCopy, columnKeyCreator, existingGroups) {\n if (!defs)\n return [];\n const result = new Array(defs.length);\n for (let i = 0; i < result.length; i++) {\n const def = defs[i];\n if (this.isColumnGroup(def)) {\n result[i] = this.createColumnGroup(primaryColumns, def, level, existingColsCopy, columnKeyCreator, existingGroups);\n }\n else {\n result[i] = this.createColumn(primaryColumns, def, existingColsCopy, columnKeyCreator);\n }\n }\n return result;\n }\n createColumnGroup(primaryColumns, colGroupDef, level, existingColumns, columnKeyCreator, existingGroups) {\n const colGroupDefMerged = this.createMergedColGroupDef(colGroupDef);\n const groupId = columnKeyCreator.getUniqueKey(colGroupDefMerged.groupId || null, null);\n const providedGroup = new ProvidedColumnGroup(colGroupDefMerged, groupId, false, level);\n this.createBean(providedGroup);\n const existingGroup = this.findExistingGroup(colGroupDef, existingGroups);\n // make sure we remove, so if user provided duplicate id, then we don't have more than\n // one column instance for colDef with common id\n if (existingGroup) {\n removeFromArray(existingGroups, existingGroup);\n }\n if (existingGroup && existingGroup.isExpanded()) {\n providedGroup.setExpanded(true);\n }\n const children = this.recursivelyCreateColumns(colGroupDefMerged.children, level + 1, primaryColumns, existingColumns, columnKeyCreator, existingGroups);\n providedGroup.setChildren(children);\n return providedGroup;\n }\n createMergedColGroupDef(colGroupDef) {\n const colGroupDefMerged = {};\n Object.assign(colGroupDefMerged, this.gridOptionsService.get('defaultColGroupDef'));\n Object.assign(colGroupDefMerged, colGroupDef);\n return colGroupDefMerged;\n }\n createColumn(primaryColumns, colDef, existingColsCopy, columnKeyCreator) {\n // see if column already exists\n let column = this.findExistingColumn(colDef, existingColsCopy);\n // make sure we remove, so if user provided duplicate id, then we don't have more than\n // one column instance for colDef with common id\n if (existingColsCopy && column) {\n removeFromArray(existingColsCopy, column);\n }\n if (!column) {\n // no existing column, need to create one\n const colId = columnKeyCreator.getUniqueKey(colDef.colId, colDef.field);\n const colDefMerged = this.addColumnDefaultAndTypes(colDef, colId);\n column = new Column(colDefMerged, colDef, colId, primaryColumns);\n this.context.createBean(column);\n }\n else {\n const colDefMerged = this.addColumnDefaultAndTypes(colDef, column.getColId());\n column.setColDef(colDefMerged, colDef);\n this.applyColumnState(column, colDefMerged);\n }\n this.dataTypeService.addColumnListeners(column);\n return column;\n }\n applyColumnState(column, colDef) {\n // flex\n const flex = attrToNumber(colDef.flex);\n if (flex !== undefined) {\n column.setFlex(flex);\n }\n // width - we only set width if column is not flexing\n const noFlexThisCol = column.getFlex() <= 0;\n if (noFlexThisCol) {\n // both null and undefined means we skip, as it's not possible to 'clear' width (a column must have a width)\n const width = attrToNumber(colDef.width);\n if (width != null) {\n column.setActualWidth(width);\n }\n else {\n // otherwise set the width again, in case min or max width has changed,\n // and width needs to be adjusted.\n const widthBeforeUpdate = column.getActualWidth();\n column.setActualWidth(widthBeforeUpdate);\n }\n }\n // sort - anything but undefined will set sort, thus null or empty string will clear the sort\n if (colDef.sort !== undefined) {\n if (colDef.sort == 'asc' || colDef.sort == 'desc') {\n column.setSort(colDef.sort);\n }\n else {\n column.setSort(undefined);\n }\n }\n // sorted at - anything but undefined, thus null will clear the sortIndex\n const sortIndex = attrToNumber(colDef.sortIndex);\n if (sortIndex !== undefined) {\n column.setSortIndex(sortIndex);\n }\n // hide - anything but undefined, thus null will clear the hide\n const hide = attrToBoolean(colDef.hide);\n if (hide !== undefined) {\n column.setVisible(!hide);\n }\n // pinned - anything but undefined, thus null or empty string will remove pinned\n if (colDef.pinned !== undefined) {\n column.setPinned(colDef.pinned);\n }\n }\n findExistingColumn(newColDef, existingColsCopy) {\n if (!existingColsCopy)\n return undefined;\n for (let i = 0; i < existingColsCopy.length; i++) {\n const def = existingColsCopy[i].getUserProvidedColDef();\n if (!def)\n continue;\n const newHasId = newColDef.colId != null;\n if (newHasId) {\n if (existingColsCopy[i].getId() === newColDef.colId) {\n return existingColsCopy[i];\n }\n continue;\n }\n const newHasField = newColDef.field != null;\n if (newHasField) {\n if (def.field === newColDef.field) {\n return existingColsCopy[i];\n }\n continue;\n }\n if (def === newColDef) {\n return existingColsCopy[i];\n }\n }\n return undefined;\n }\n findExistingGroup(newGroupDef, existingGroups) {\n return existingGroups.find(existingGroup => {\n const existingDef = existingGroup.getColGroupDef();\n if (!existingDef) {\n return false;\n }\n const newHasId = newGroupDef.groupId != null;\n if (newHasId) {\n return existingGroup.getId() === newGroupDef.groupId;\n }\n return false;\n });\n }\n addColumnDefaultAndTypes(colDef, colId) {\n // start with empty merged definition\n const res = {};\n // merge properties from default column definitions\n const defaultColDef = this.gridOptionsService.get('defaultColDef');\n mergeDeep(res, defaultColDef, false, true);\n const columnType = this.dataTypeService.updateColDefAndGetColumnType(res, colDef, colId);\n if (columnType) {\n this.assignColumnTypes(columnType, res);\n }\n // merge properties from column definitions\n mergeDeep(res, colDef, false, true);\n const autoGroupColDef = this.gridOptionsService.get('autoGroupColumnDef');\n const isSortingCoupled = this.gridOptionsService.isColumnsSortingCoupledToGroup();\n if (colDef.rowGroup && autoGroupColDef && isSortingCoupled) {\n // override the sort for row group columns where the autoGroupColDef defines these values.\n mergeDeep(res, { sort: autoGroupColDef.sort, initialSort: autoGroupColDef.initialSort }, false, true);\n }\n this.dataTypeService.validateColDef(res);\n return res;\n }\n assignColumnTypes(typeKeys, colDefMerged) {\n if (!typeKeys.length) {\n return;\n }\n // merge user defined with default column types\n const allColumnTypes = Object.assign({}, DefaultColumnTypes);\n const userTypes = this.gridOptionsService.get('columnTypes') || {};\n iterateObject(userTypes, (key, value) => {\n if (key in allColumnTypes) {\n console.warn(`AG Grid: the column type '${key}' is a default column type and cannot be overridden.`);\n }\n else {\n allColumnTypes[key] = value;\n }\n });\n typeKeys.forEach((t) => {\n const typeColDef = allColumnTypes[t.trim()];\n if (typeColDef) {\n mergeDeep(colDefMerged, typeColDef, false, true);\n }\n else {\n console.warn(\"AG Grid: colDef.type '\" + t + \"' does not correspond to defined gridOptions.columnTypes\");\n }\n });\n }\n // if object has children, we assume it's a group\n isColumnGroup(abstractColDef) {\n return abstractColDef.children !== undefined;\n }\n};\n__decorate([\n Autowired('columnUtils')\n], ColumnFactory.prototype, \"columnUtils\", void 0);\n__decorate([\n Autowired('dataTypeService')\n], ColumnFactory.prototype, \"dataTypeService\", void 0);\n__decorate([\n __param(0, Qualifier('loggerFactory'))\n], ColumnFactory.prototype, \"setBeans\", null);\nColumnFactory = __decorate([\n Bean('columnFactory')\n], ColumnFactory);\nexport { ColumnFactory };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Column } from \"./column.mjs\";\nimport { EventService } from \"../eventService.mjs\";\nimport { Autowired } from \"../context/context.mjs\";\nimport { last } from \"../utils/array.mjs\";\nexport class ColumnGroup {\n constructor(providedColumnGroup, groupId, partId, pinned) {\n // depends on the open/closed state of the group, only displaying columns are stored here\n this.displayedChildren = [];\n this.localEventService = new EventService();\n this.groupId = groupId;\n this.partId = partId;\n this.providedColumnGroup = providedColumnGroup;\n this.pinned = pinned;\n }\n // this is static, a it is used outside of this class\n static createUniqueId(groupId, instanceId) {\n return groupId + '_' + instanceId;\n }\n // as the user is adding and removing columns, the groups are recalculated.\n // this reset clears out all children, ready for children to be added again\n reset() {\n this.parent = null;\n this.children = null;\n this.displayedChildren = null;\n }\n getParent() {\n return this.parent;\n }\n setParent(parent) {\n this.parent = parent;\n }\n getUniqueId() {\n return ColumnGroup.createUniqueId(this.groupId, this.partId);\n }\n isEmptyGroup() {\n return this.displayedChildren.length === 0;\n }\n isMoving() {\n const allLeafColumns = this.getProvidedColumnGroup().getLeafColumns();\n if (!allLeafColumns || allLeafColumns.length === 0) {\n return false;\n }\n return allLeafColumns.every(col => col.isMoving());\n }\n checkLeft() {\n // first get all children to setLeft, as it impacts our decision below\n this.displayedChildren.forEach((child) => {\n if (child instanceof ColumnGroup) {\n child.checkLeft();\n }\n });\n // set our left based on first displayed column\n if (this.displayedChildren.length > 0) {\n if (this.gridOptionsService.is('enableRtl')) {\n const lastChild = last(this.displayedChildren);\n const lastChildLeft = lastChild.getLeft();\n this.setLeft(lastChildLeft);\n }\n else {\n const firstChildLeft = this.displayedChildren[0].getLeft();\n this.setLeft(firstChildLeft);\n }\n }\n else {\n // this should never happen, as if we have no displayed columns, then\n // this groups should not even exist.\n this.setLeft(null);\n }\n }\n getLeft() {\n return this.left;\n }\n getOldLeft() {\n return this.oldLeft;\n }\n setLeft(left) {\n this.oldLeft = left;\n if (this.left !== left) {\n this.left = left;\n this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_LEFT_CHANGED));\n }\n }\n getPinned() {\n return this.pinned;\n }\n createAgEvent(type) {\n return { type };\n }\n addEventListener(eventType, listener) {\n this.localEventService.addEventListener(eventType, listener);\n }\n removeEventListener(eventType, listener) {\n this.localEventService.removeEventListener(eventType, listener);\n }\n getGroupId() {\n return this.groupId;\n }\n getPartId() {\n return this.partId;\n }\n isChildInThisGroupDeepSearch(wantedChild) {\n let result = false;\n this.children.forEach((foundChild) => {\n if (wantedChild === foundChild) {\n result = true;\n }\n if (foundChild instanceof ColumnGroup) {\n if (foundChild.isChildInThisGroupDeepSearch(wantedChild)) {\n result = true;\n }\n }\n });\n return result;\n }\n getActualWidth() {\n let groupActualWidth = 0;\n if (this.displayedChildren) {\n this.displayedChildren.forEach((child) => {\n groupActualWidth += child.getActualWidth();\n });\n }\n return groupActualWidth;\n }\n isResizable() {\n if (!this.displayedChildren) {\n return false;\n }\n // if at least one child is resizable, then the group is resizable\n let result = false;\n this.displayedChildren.forEach((child) => {\n if (child.isResizable()) {\n result = true;\n }\n });\n return result;\n }\n getMinWidth() {\n let result = 0;\n this.displayedChildren.forEach((groupChild) => {\n result += groupChild.getMinWidth() || 0;\n });\n return result;\n }\n addChild(child) {\n if (!this.children) {\n this.children = [];\n }\n this.children.push(child);\n }\n getDisplayedChildren() {\n return this.displayedChildren;\n }\n getLeafColumns() {\n const result = [];\n this.addLeafColumns(result);\n return result;\n }\n getDisplayedLeafColumns() {\n const result = [];\n this.addDisplayedLeafColumns(result);\n return result;\n }\n getDefinition() {\n return this.providedColumnGroup.getColGroupDef();\n }\n getColGroupDef() {\n return this.providedColumnGroup.getColGroupDef();\n }\n isPadding() {\n return this.providedColumnGroup.isPadding();\n }\n isExpandable() {\n return this.providedColumnGroup.isExpandable();\n }\n isExpanded() {\n return this.providedColumnGroup.isExpanded();\n }\n setExpanded(expanded) {\n this.providedColumnGroup.setExpanded(expanded);\n }\n addDisplayedLeafColumns(leafColumns) {\n this.displayedChildren.forEach((child) => {\n if (child instanceof Column) {\n leafColumns.push(child);\n }\n else if (child instanceof ColumnGroup) {\n child.addDisplayedLeafColumns(leafColumns);\n }\n });\n }\n addLeafColumns(leafColumns) {\n this.children.forEach((child) => {\n if (child instanceof Column) {\n leafColumns.push(child);\n }\n else if (child instanceof ColumnGroup) {\n child.addLeafColumns(leafColumns);\n }\n });\n }\n getChildren() {\n return this.children;\n }\n getColumnGroupShow() {\n return this.providedColumnGroup.getColumnGroupShow();\n }\n getProvidedColumnGroup() {\n return this.providedColumnGroup;\n }\n getPaddingLevel() {\n const parent = this.getParent();\n if (!this.isPadding() || !parent || !parent.isPadding()) {\n return 0;\n }\n return 1 + parent.getPaddingLevel();\n }\n calculateDisplayedColumns() {\n // clear out last time we calculated\n this.displayedChildren = [];\n // find the column group that is controlling expandable. this is relevant when we have padding (empty)\n // groups, where the expandable is actually the first parent that is not a padding group.\n let parentWithExpansion = this;\n while (parentWithExpansion != null && parentWithExpansion.isPadding()) {\n parentWithExpansion = parentWithExpansion.getParent();\n }\n const isExpandable = parentWithExpansion ? parentWithExpansion.providedColumnGroup.isExpandable() : false;\n // it not expandable, everything is visible\n if (!isExpandable) {\n this.displayedChildren = this.children;\n this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED));\n return;\n }\n // Add cols based on columnGroupShow\n // Note - the below also adds padding groups, these are always added because they never have\n // colDef.columnGroupShow set.\n this.children.forEach(child => {\n // never add empty groups\n const emptyGroup = child instanceof ColumnGroup && (!child.displayedChildren || !child.displayedChildren.length);\n if (emptyGroup) {\n return;\n }\n const headerGroupShow = child.getColumnGroupShow();\n switch (headerGroupShow) {\n case 'open':\n // when set to open, only show col if group is open\n if (parentWithExpansion.providedColumnGroup.isExpanded()) {\n this.displayedChildren.push(child);\n }\n break;\n case 'closed':\n // when set to open, only show col if group is open\n if (!parentWithExpansion.providedColumnGroup.isExpanded()) {\n this.displayedChildren.push(child);\n }\n break;\n default:\n this.displayedChildren.push(child);\n break;\n }\n });\n this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED));\n }\n}\nColumnGroup.EVENT_LEFT_CHANGED = 'leftChanged';\nColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED = 'displayedChildrenChanged';\n__decorate([\n Autowired('gridOptionsService')\n], ColumnGroup.prototype, \"gridOptionsService\", void 0);\n","export class Events {\n}\n/** Everything has changed with the columns. Either complete new set of columns set, or user called applyColumnState() */\n/** @deprecated - grid no longer uses this, and setSate() also fires individual events */\nEvents.EVENT_COLUMN_EVERYTHING_CHANGED = 'columnEverythingChanged';\n/** User has set in new columns. */\nEvents.EVENT_NEW_COLUMNS_LOADED = 'newColumnsLoaded';\n/** The pivot mode flag was changed */\nEvents.EVENT_COLUMN_PIVOT_MODE_CHANGED = 'columnPivotModeChanged';\n/** A row group column was added, removed or order changed. */\nEvents.EVENT_COLUMN_ROW_GROUP_CHANGED = 'columnRowGroupChanged';\n/** expandAll / collapseAll was called from the api. */\nEvents.EVENT_EXPAND_COLLAPSE_ALL = 'expandOrCollapseAll';\n/** A pivot column was added, removed or order changed. */\nEvents.EVENT_COLUMN_PIVOT_CHANGED = 'columnPivotChanged';\n/** The list of grid columns has changed. */\nEvents.EVENT_GRID_COLUMNS_CHANGED = 'gridColumnsChanged';\n/** A value column was added, removed or agg function was changed. */\nEvents.EVENT_COLUMN_VALUE_CHANGED = 'columnValueChanged';\n/** A column was moved */\nEvents.EVENT_COLUMN_MOVED = 'columnMoved';\n/** One or more columns was shown / hidden */\nEvents.EVENT_COLUMN_VISIBLE = 'columnVisible';\n/** One or more columns was pinned / unpinned*/\nEvents.EVENT_COLUMN_PINNED = 'columnPinned';\n/** A column group was opened / closed */\nEvents.EVENT_COLUMN_GROUP_OPENED = 'columnGroupOpened';\n/** One or more columns was resized. If just one, the column in the event is set. */\nEvents.EVENT_COLUMN_RESIZED = 'columnResized';\n/** The list of displayed columns has changed, can result from columns open / close, column move, pivot, group, etc */\nEvents.EVENT_DISPLAYED_COLUMNS_CHANGED = 'displayedColumnsChanged';\n/** The list of virtual columns has changed, results from viewport changing */\nEvents.EVENT_VIRTUAL_COLUMNS_CHANGED = 'virtualColumnsChanged';\n/** Async Transactions Executed */\nEvents.EVENT_ASYNC_TRANSACTIONS_FLUSHED = 'asyncTransactionsFlushed';\n/** A row group was opened / closed */\nEvents.EVENT_ROW_GROUP_OPENED = 'rowGroupOpened';\n/** @deprecated v28 use EVENT_ROW_DATA_UPDATED instead */\nEvents.EVENT_ROW_DATA_CHANGED = 'rowDataChanged';\n/** The client has updated data for the grid */\nEvents.EVENT_ROW_DATA_UPDATED = 'rowDataUpdated';\n/** The client has set new floating data into the grid */\nEvents.EVENT_PINNED_ROW_DATA_CHANGED = 'pinnedRowDataChanged';\n/** Range selection has changed */\nEvents.EVENT_RANGE_SELECTION_CHANGED = 'rangeSelectionChanged';\n/** Chart was created */\nEvents.EVENT_CHART_CREATED = 'chartCreated';\n/** Chart Range selection has changed */\nEvents.EVENT_CHART_RANGE_SELECTION_CHANGED = 'chartRangeSelectionChanged';\n/** Chart Options have changed */\nEvents.EVENT_CHART_OPTIONS_CHANGED = 'chartOptionsChanged';\n/** Chart was destroyed */\nEvents.EVENT_CHART_DESTROYED = 'chartDestroyed';\n/** For when the tool panel is shown / hidden */\nEvents.EVENT_TOOL_PANEL_VISIBLE_CHANGED = 'toolPanelVisibleChanged';\nEvents.EVENT_TOOL_PANEL_SIZE_CHANGED = 'toolPanelSizeChanged';\nEvents.EVENT_COLUMN_PANEL_ITEM_DRAG_START = 'columnPanelItemDragStart';\nEvents.EVENT_COLUMN_PANEL_ITEM_DRAG_END = 'columnPanelItemDragEnd';\n/** Model was updated - grid updates the drawn rows when this happens */\nEvents.EVENT_MODEL_UPDATED = 'modelUpdated';\nEvents.EVENT_CUT_START = 'cutStart';\nEvents.EVENT_CUT_END = 'cutEnd';\nEvents.EVENT_PASTE_START = 'pasteStart';\nEvents.EVENT_PASTE_END = 'pasteEnd';\nEvents.EVENT_FILL_START = 'fillStart';\nEvents.EVENT_FILL_END = 'fillEnd';\nEvents.EVENT_RANGE_DELETE_START = 'rangeDeleteStart';\nEvents.EVENT_RANGE_DELETE_END = 'rangeDeleteEnd';\n/** Undo operation has started. */\nEvents.EVENT_UNDO_STARTED = 'undoStarted';\n/** Undo operation has ended. */\nEvents.EVENT_UNDO_ENDED = 'undoEnded';\n/** Redo operation has started. */\nEvents.EVENT_REDO_STARTED = 'redoStarted';\n/** Redo operation has ended. */\nEvents.EVENT_REDO_ENDED = 'redoEnded';\nEvents.EVENT_KEY_SHORTCUT_CHANGED_CELL_START = 'keyShortcutChangedCellStart';\nEvents.EVENT_KEY_SHORTCUT_CHANGED_CELL_END = 'keyShortcutChangedCellEnd';\nEvents.EVENT_CELL_CLICKED = 'cellClicked';\nEvents.EVENT_CELL_DOUBLE_CLICKED = 'cellDoubleClicked';\nEvents.EVENT_CELL_MOUSE_DOWN = 'cellMouseDown';\nEvents.EVENT_CELL_CONTEXT_MENU = 'cellContextMenu';\nEvents.EVENT_CELL_VALUE_CHANGED = 'cellValueChanged';\nEvents.EVENT_CELL_EDIT_REQUEST = 'cellEditRequest';\nEvents.EVENT_ROW_VALUE_CHANGED = 'rowValueChanged';\nEvents.EVENT_CELL_FOCUSED = 'cellFocused';\nEvents.EVENT_CELL_FOCUS_CLEARED = 'cellFocusCleared';\nEvents.EVENT_FULL_WIDTH_ROW_FOCUSED = 'fullWidthRowFocused';\nEvents.EVENT_ROW_SELECTED = 'rowSelected';\nEvents.EVENT_SELECTION_CHANGED = 'selectionChanged';\nEvents.EVENT_TOOLTIP_SHOW = 'tooltipShow';\nEvents.EVENT_TOOLTIP_HIDE = 'tooltipHide';\nEvents.EVENT_CELL_KEY_DOWN = 'cellKeyDown';\nEvents.EVENT_CELL_MOUSE_OVER = 'cellMouseOver';\nEvents.EVENT_CELL_MOUSE_OUT = 'cellMouseOut';\n/** 2 events for filtering. The grid LISTENS for filterChanged and afterFilterChanged */\nEvents.EVENT_FILTER_CHANGED = 'filterChanged';\n/** Filter was change but not applied. Only useful if apply buttons are used in filters. */\nEvents.EVENT_FILTER_MODIFIED = 'filterModified';\nEvents.EVENT_FILTER_OPENED = 'filterOpened';\nEvents.EVENT_SORT_CHANGED = 'sortChanged';\n/** A row was removed from the dom, for any reason. Use to clean up resources (if any) used by the row. */\nEvents.EVENT_VIRTUAL_ROW_REMOVED = 'virtualRowRemoved';\nEvents.EVENT_ROW_CLICKED = 'rowClicked';\nEvents.EVENT_ROW_DOUBLE_CLICKED = 'rowDoubleClicked';\n/** Gets called once after the grid has finished initialising. */\nEvents.EVENT_GRID_READY = 'gridReady';\n/** Width of height of the main grid div has changed. Grid listens for this and does layout of grid if it's\n * changed, so always filling the space it was given. */\nEvents.EVENT_GRID_SIZE_CHANGED = 'gridSizeChanged';\n/** The indexes of the rows rendered has changed, eg user has scrolled to a new vertical position. */\nEvents.EVENT_VIEWPORT_CHANGED = 'viewportChanged';\n/* The width of the scrollbar has been calculated */\nEvents.EVENT_SCROLLBAR_WIDTH_CHANGED = 'scrollbarWidthChanged';\n/** Rows were rendered for the first time (ie on async data load). */\nEvents.EVENT_FIRST_DATA_RENDERED = 'firstDataRendered';\n/** A column drag has started, either resizing a column or moving a column. */\nEvents.EVENT_DRAG_STARTED = 'dragStarted';\n/** A column drag has stopped */\nEvents.EVENT_DRAG_STOPPED = 'dragStopped';\nEvents.EVENT_CHECKBOX_CHANGED = 'checkboxChanged';\nEvents.EVENT_ROW_EDITING_STARTED = 'rowEditingStarted';\nEvents.EVENT_ROW_EDITING_STOPPED = 'rowEditingStopped';\nEvents.EVENT_CELL_EDITING_STARTED = 'cellEditingStarted';\nEvents.EVENT_CELL_EDITING_STOPPED = 'cellEditingStopped';\n/** Main body of grid has scrolled, either horizontally or vertically */\nEvents.EVENT_BODY_SCROLL = 'bodyScroll';\n/** Main body of the grid has stopped scrolling, either horizontally or vertically */\nEvents.EVENT_BODY_SCROLL_END = 'bodyScrollEnd';\nEvents.EVENT_HEIGHT_SCALE_CHANGED = 'heightScaleChanged';\n/** The displayed page for pagination has changed. For example the data was filtered or sorted,\n * or the user has moved to a different page. */\nEvents.EVENT_PAGINATION_CHANGED = 'paginationChanged';\n/** Only used by React, Angular, Web Components and VueJS AG Grid components\n * (not used if doing plain JavaScript). If the grid receives changes due\n * to bound properties, this event fires after the grid has finished processing the change. */\nEvents.EVENT_COMPONENT_STATE_CHANGED = 'componentStateChanged';\n/** Only used by the SSRM, called when the grid has no more rows to refresh */\nEvents.EVENT_STORE_REFRESHED = 'storeRefreshed';\n/***************************** INTERNAL EVENTS: START ******************************************* */\n/** Please remember to add to ComponentUtil.EXCLUDED_INTERNAL_EVENTS to not have these events exposed to framework components. */\n/** All items from here down are used internally by the grid, not intended for external use. */\n// not documented, either experimental, or we just don't want users using an depending on them\nEvents.EVENT_BODY_HEIGHT_CHANGED = 'bodyHeightChanged';\nEvents.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED = 'displayedColumnsWidthChanged';\nEvents.EVENT_SCROLL_VISIBILITY_CHANGED = 'scrollVisibilityChanged';\nEvents.EVENT_COLUMN_HOVER_CHANGED = 'columnHoverChanged';\nEvents.EVENT_FLASH_CELLS = 'flashCells';\nEvents.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED = 'paginationPixelOffsetChanged';\nEvents.EVENT_DISPLAYED_ROWS_CHANGED = 'displayedRowsChanged';\nEvents.EVENT_LEFT_PINNED_WIDTH_CHANGED = 'leftPinnedWidthChanged';\nEvents.EVENT_RIGHT_PINNED_WIDTH_CHANGED = 'rightPinnedWidthChanged';\nEvents.EVENT_ROW_CONTAINER_HEIGHT_CHANGED = 'rowContainerHeightChanged';\nEvents.EVENT_HEADER_HEIGHT_CHANGED = 'headerHeightChanged';\nEvents.EVENT_COLUMN_HEADER_HEIGHT_CHANGED = 'columnHeaderHeightChanged';\nEvents.EVENT_ROW_DRAG_ENTER = 'rowDragEnter';\nEvents.EVENT_ROW_DRAG_MOVE = 'rowDragMove';\nEvents.EVENT_ROW_DRAG_LEAVE = 'rowDragLeave';\nEvents.EVENT_ROW_DRAG_END = 'rowDragEnd';\n// environment\nEvents.EVENT_GRID_STYLES_CHANGED = 'gridStylesChanged';\n// primarily for charts\nEvents.EVENT_POPUP_TO_FRONT = 'popupToFront';\n// these are used for server side group and agg - only used by CS with Viewport Row Model - intention is\n// to design these better around server side functions and then release to general public when fully working with\n// all the row models.\nEvents.EVENT_COLUMN_ROW_GROUP_CHANGE_REQUEST = 'columnRowGroupChangeRequest';\nEvents.EVENT_COLUMN_PIVOT_CHANGE_REQUEST = 'columnPivotChangeRequest';\nEvents.EVENT_COLUMN_VALUE_CHANGE_REQUEST = 'columnValueChangeRequest';\nEvents.EVENT_COLUMN_AGG_FUNC_CHANGE_REQUEST = 'columnAggFuncChangeRequest';\nEvents.EVENT_KEYBOARD_FOCUS = 'keyboardFocus';\nEvents.EVENT_MOUSE_FOCUS = 'mouseFocus';\nEvents.EVENT_STORE_UPDATED = 'storeUpdated';\nEvents.EVENT_FILTER_DESTROYED = 'filterDestroyed';\nEvents.EVENT_ROW_DATA_UPDATE_STARTED = 'rowDataUpdateStarted';\n// Advanced Filters\nEvents.EVENT_ADVANCED_FILTER_ENABLED_CHANGED = 'advancedFilterEnabledChanged';\nEvents.EVENT_DATA_TYPES_INFERRED = 'dataTypesInferred';\n// Widgets\nEvents.EVENT_FIELD_VALUE_CHANGED = 'fieldValueChanged';\nEvents.EVENT_FIELD_PICKER_VALUE_SELECTED = 'fieldPickerValueSelected';\n","// class returns unique instance id's for columns.\n// eg, the following calls (in this order) will result in:\n//\n// getInstanceIdForKey('country') => 0\n// getInstanceIdForKey('country') => 1\n// getInstanceIdForKey('country') => 2\n// getInstanceIdForKey('country') => 3\n// getInstanceIdForKey('age') => 0\n// getInstanceIdForKey('age') => 1\n// getInstanceIdForKey('country') => 4\nexport class GroupInstanceIdCreator {\n constructor() {\n // this map contains keys to numbers, so we remember what the last call was\n this.existingIds = {};\n }\n getInstanceIdForKey(key) {\n const lastResult = this.existingIds[key];\n let result;\n if (typeof lastResult !== 'number') {\n // first time this key\n result = 0;\n }\n else {\n result = lastResult + 1;\n }\n this.existingIds[key] = result;\n return result;\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean } from \"../context/context.mjs\";\nimport { Column } from \"../entities/column.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { mergeDeep } from \"../utils/object.mjs\";\nimport { missing } from \"../utils/generic.mjs\";\nexport const GROUP_AUTO_COLUMN_ID = 'ag-Grid-AutoColumn';\nlet AutoGroupColService = class AutoGroupColService extends BeanStub {\n createAutoGroupColumns(rowGroupColumns) {\n const groupAutoColumns = [];\n const doingTreeData = this.gridOptionsService.isTreeData();\n let doingMultiAutoColumn = this.gridOptionsService.isGroupMultiAutoColumn();\n if (doingTreeData && doingMultiAutoColumn) {\n console.warn('AG Grid: you cannot mix groupDisplayType = \"multipleColumns\" with treeData, only one column can be used to display groups when doing tree data');\n doingMultiAutoColumn = false;\n }\n // if doing groupDisplayType = \"multipleColumns\", then we call the method multiple times, once\n // for each column we are grouping by\n if (doingMultiAutoColumn) {\n rowGroupColumns.forEach((rowGroupCol, index) => {\n groupAutoColumns.push(this.createOneAutoGroupColumn(rowGroupCol, index));\n });\n }\n else {\n groupAutoColumns.push(this.createOneAutoGroupColumn());\n }\n return groupAutoColumns;\n }\n updateAutoGroupColumns(autoGroupColumns) {\n autoGroupColumns.forEach((column, index) => this.updateOneAutoGroupColumn(column, index));\n }\n // rowGroupCol and index are missing if groupDisplayType != \"multipleColumns\"\n createOneAutoGroupColumn(rowGroupCol, index) {\n // if doing multi, set the field\n let colId;\n if (rowGroupCol) {\n colId = `${GROUP_AUTO_COLUMN_ID}-${rowGroupCol.getId()}`;\n }\n else {\n colId = GROUP_AUTO_COLUMN_ID;\n }\n const colDef = this.createAutoGroupColDef(colId, rowGroupCol, index);\n colDef.colId = colId;\n const newCol = new Column(colDef, null, colId, true);\n this.context.createBean(newCol);\n return newCol;\n }\n /**\n * Refreshes an auto group col to load changes from defaultColDef or autoGroupColDef\n */\n updateOneAutoGroupColumn(colToUpdate, index) {\n const oldColDef = colToUpdate.getColDef();\n const underlyingColId = typeof oldColDef.showRowGroup == 'string' ? oldColDef.showRowGroup : undefined;\n const underlyingColumn = underlyingColId != null ? this.columnModel.getPrimaryColumn(underlyingColId) : undefined;\n const colDef = this.createAutoGroupColDef(colToUpdate.getId(), underlyingColumn !== null && underlyingColumn !== void 0 ? underlyingColumn : undefined, index);\n colToUpdate.setColDef(colDef, null);\n this.columnFactory.applyColumnState(colToUpdate, colDef);\n }\n createAutoGroupColDef(colId, underlyingColumn, index) {\n // if one provided by user, use it, otherwise create one\n let res = this.createBaseColDef(underlyingColumn);\n const autoGroupColumnDef = this.gridOptionsService.get('autoGroupColumnDef');\n mergeDeep(res, autoGroupColumnDef);\n res = this.columnFactory.addColumnDefaultAndTypes(res, colId);\n // For tree data the filter is always allowed\n if (!this.gridOptionsService.isTreeData()) {\n // we would only allow filter if the user has provided field or value getter. otherwise the filter\n // would not be able to work.\n const noFieldOrValueGetter = missing(res.field) &&\n missing(res.valueGetter) &&\n missing(res.filterValueGetter) &&\n res.filter !== 'agGroupColumnFilter';\n if (noFieldOrValueGetter) {\n res.filter = false;\n }\n }\n // if showing many cols, we don't want to show more than one with a checkbox for selection\n if (index && index > 0) {\n res.headerCheckboxSelection = false;\n }\n const isSortingCoupled = this.gridOptionsService.isColumnsSortingCoupledToGroup();\n const hasOwnData = res.valueGetter || res.field != null;\n if (isSortingCoupled && !hasOwnData) {\n // if col is coupled sorting, and has sort attribute, we want to ignore this\n // because we only accept the sort on creation of the col\n res.sortIndex = undefined;\n res.initialSort = undefined;\n }\n return res;\n }\n createBaseColDef(rowGroupCol) {\n const userDef = this.gridOptionsService.get('autoGroupColumnDef');\n const localeTextFunc = this.localeService.getLocaleTextFunc();\n const res = {\n headerName: localeTextFunc('group', 'Group')\n };\n const userHasProvidedGroupCellRenderer = userDef &&\n (userDef.cellRenderer || userDef.cellRendererSelector);\n // only add the default group cell renderer if user hasn't provided one\n if (!userHasProvidedGroupCellRenderer) {\n res.cellRenderer = 'agGroupCellRenderer';\n }\n // we never allow moving the group column\n // defaultAutoColDef.suppressMovable = true;\n if (rowGroupCol) {\n const colDef = rowGroupCol.getColDef();\n Object.assign(res, {\n // cellRendererParams.groupKey: colDefToCopy.field;\n headerName: this.columnModel.getDisplayNameForColumn(rowGroupCol, 'header'),\n headerValueGetter: colDef.headerValueGetter\n });\n if (colDef.cellRenderer) {\n Object.assign(res, {\n cellRendererParams: {\n innerRenderer: colDef.cellRenderer,\n innerRendererParams: colDef.cellRendererParams\n }\n });\n }\n res.showRowGroup = rowGroupCol.getColId();\n }\n else {\n res.showRowGroup = true;\n }\n return res;\n }\n};\n__decorate([\n Autowired('columnModel')\n], AutoGroupColService.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('columnFactory')\n], AutoGroupColService.prototype, \"columnFactory\", void 0);\nAutoGroupColService = __decorate([\n Bean('autoGroupColService')\n], AutoGroupColService);\nexport { AutoGroupColService };\n","const reUnescapedHtml = /[&<>\"']/g;\n/**\n * HTML Escapes.\n */\nconst HTML_ESCAPES = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": '''\n};\n/**\n * It encodes any string in UTF-8 format\n * taken from https://github.com/mathiasbynens/utf8.js\n * @param {string} s\n * @returns {string}\n */\nexport function utf8_encode(s) {\n const stringFromCharCode = String.fromCharCode;\n function ucs2decode(string) {\n const output = [];\n if (!string) {\n return [];\n }\n const len = string.length;\n let counter = 0;\n let value;\n let extra;\n while (counter < len) {\n value = string.charCodeAt(counter++);\n if (value >= 0xD800 && value <= 0xDBFF && counter < len) {\n // high surrogate, and there is a next character\n extra = string.charCodeAt(counter++);\n if ((extra & 0xFC00) == 0xDC00) { // low surrogate\n output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n }\n else {\n // unmatched surrogate; only append this code unit, in case the next\n // code unit is the high surrogate of a surrogate pair\n output.push(value);\n counter--;\n }\n }\n else {\n output.push(value);\n }\n }\n return output;\n }\n function checkScalarValue(point) {\n if (point >= 0xD800 && point <= 0xDFFF) {\n throw Error('Lone surrogate U+' + point.toString(16).toUpperCase() +\n ' is not a scalar value');\n }\n }\n function createByte(point, shift) {\n return stringFromCharCode(((point >> shift) & 0x3F) | 0x80);\n }\n function encodeCodePoint(point) {\n if ((point >= 0 && point <= 31 && point !== 10)) {\n const convertedCode = point.toString(16).toUpperCase();\n const paddedCode = convertedCode.padStart(4, '0');\n return `_x${paddedCode}_`;\n }\n if ((point & 0xFFFFFF80) == 0) { // 1-byte sequence\n return stringFromCharCode(point);\n }\n let symbol = '';\n if ((point & 0xFFFFF800) == 0) { // 2-byte sequence\n symbol = stringFromCharCode(((point >> 6) & 0x1F) | 0xC0);\n }\n else if ((point & 0xFFFF0000) == 0) { // 3-byte sequence\n checkScalarValue(point);\n symbol = stringFromCharCode(((point >> 12) & 0x0F) | 0xE0);\n symbol += createByte(point, 6);\n }\n else if ((point & 0xFFE00000) == 0) { // 4-byte sequence\n symbol = stringFromCharCode(((point >> 18) & 0x07) | 0xF0);\n symbol += createByte(point, 12);\n symbol += createByte(point, 6);\n }\n symbol += stringFromCharCode((point & 0x3F) | 0x80);\n return symbol;\n }\n const codePoints = ucs2decode(s);\n const length = codePoints.length;\n let index = -1;\n let codePoint;\n let byteString = '';\n while (++index < length) {\n codePoint = codePoints[index];\n byteString += encodeCodePoint(codePoint);\n }\n return byteString;\n}\nexport function capitalise(str) {\n return str[0].toUpperCase() + str.substr(1).toLowerCase();\n}\nexport function escapeString(toEscape, skipEscapingHtmlChars) {\n if (toEscape == null) {\n return null;\n }\n // we call toString() twice, in case value is an object, where user provides\n // a toString() method, and first call to toString() returns back something other\n // than a string (eg a number to render)\n const stringResult = toEscape.toString().toString();\n if (skipEscapingHtmlChars) {\n return stringResult;\n }\n // in react we don't need to escape html characters, as it's done by the framework\n return stringResult.replace(reUnescapedHtml, chr => HTML_ESCAPES[chr]);\n}\n/**\n * Converts a camelCase string into startCase\n * @param {string} camelCase\n * @return {string}\n */\nexport function camelCaseToHumanText(camelCase) {\n if (!camelCase || camelCase == null) {\n return null;\n }\n // either split on a lowercase followed by uppercase ie asHereTo -> as Here To\n const rex = /([a-z])([A-Z])/g;\n // or starts with uppercase and we take all expect the last which is assumed to be part of next word if followed by lowercase HEREToThere -> HERE To There\n const rexCaps = /([A-Z]+)([A-Z])([a-z])/g;\n const words = camelCase\n .replace(rex, '$1 $2')\n .replace(rexCaps, '$1 $2$3')\n .replace(/\\./g, ' ')\n .split(' ');\n return words.map(word => word.substring(0, 1).toUpperCase() + ((word.length > 1) ? word.substring(1, word.length) : '')).join(' ');\n}\n/**\n * Converts a camelCase string into hyphenated string\n * @param {string} camelCase\n * @return {string}\n */\nexport function camelCaseToHyphenated(camelCase) {\n return camelCase.replace(/[A-Z]/g, s => `-${s.toLocaleLowerCase()}`);\n}\n","export function convertToMap(arr) {\n const map = new Map();\n arr.forEach(pair => map.set(pair[0], pair[1]));\n return map;\n}\n// handy for organising a list into a map, where each item is mapped by an attribute, eg mapping Columns by ID\nexport function mapById(arr, callback) {\n const map = new Map();\n arr.forEach(item => map.set(callback(item), item));\n return map;\n}\nexport function keys(map) {\n const arr = [];\n map.forEach((_, key) => arr.push(key));\n return arr;\n}\n","export class ColDefUtil {\n}\nColDefUtil.ColDefPropertyMap = {\n headerName: undefined,\n columnGroupShow: undefined,\n headerClass: undefined,\n toolPanelClass: undefined,\n headerValueGetter: undefined,\n pivotKeys: undefined,\n groupId: undefined,\n colId: undefined,\n sort: undefined,\n initialSort: undefined,\n field: undefined,\n type: undefined,\n cellDataType: undefined,\n tooltipComponent: undefined,\n tooltipField: undefined,\n headerTooltip: undefined,\n cellClass: undefined,\n showRowGroup: undefined,\n filter: undefined,\n initialAggFunc: undefined,\n defaultAggFunc: undefined,\n aggFunc: undefined,\n pinned: undefined,\n initialPinned: undefined,\n chartDataType: undefined,\n cellEditorPopupPosition: undefined,\n headerGroupComponent: undefined,\n headerGroupComponentParams: undefined,\n cellStyle: undefined,\n cellRenderer: undefined,\n cellRendererParams: undefined,\n cellEditor: undefined,\n cellEditorParams: undefined,\n filterParams: undefined,\n pivotValueColumn: undefined,\n headerComponent: undefined,\n headerComponentParams: undefined,\n floatingFilterComponent: undefined,\n floatingFilterComponentParams: undefined,\n tooltipComponentParams: undefined,\n refData: undefined,\n columnsMenuParams: undefined,\n children: undefined,\n sortingOrder: undefined,\n allowedAggFuncs: undefined,\n menuTabs: undefined,\n pivotTotalColumnIds: undefined,\n cellClassRules: undefined,\n icons: undefined,\n sortIndex: undefined,\n initialSortIndex: undefined,\n flex: undefined,\n initialFlex: undefined,\n width: undefined,\n initialWidth: undefined,\n minWidth: undefined,\n maxWidth: undefined,\n rowGroupIndex: undefined,\n initialRowGroupIndex: undefined,\n pivotIndex: undefined,\n initialPivotIndex: undefined,\n suppressCellFlash: undefined,\n suppressColumnsToolPanel: undefined,\n suppressFiltersToolPanel: undefined,\n openByDefault: undefined,\n marryChildren: undefined,\n suppressStickyLabel: undefined,\n hide: undefined,\n initialHide: undefined,\n rowGroup: undefined,\n initialRowGroup: undefined,\n pivot: undefined,\n initialPivot: undefined,\n checkboxSelection: undefined,\n showDisabledCheckboxes: undefined,\n headerCheckboxSelection: undefined,\n headerCheckboxSelectionFilteredOnly: undefined,\n headerCheckboxSelectionCurrentPageOnly: undefined,\n suppressMenu: undefined,\n suppressMovable: undefined,\n lockPosition: undefined,\n lockVisible: undefined,\n lockPinned: undefined,\n unSortIcon: undefined,\n suppressSizeToFit: undefined,\n suppressAutoSize: undefined,\n enableRowGroup: undefined,\n enablePivot: undefined,\n enableValue: undefined,\n editable: undefined,\n suppressPaste: undefined,\n suppressNavigable: undefined,\n enableCellChangeFlash: undefined,\n rowDrag: undefined,\n dndSource: undefined,\n autoHeight: undefined,\n wrapText: undefined,\n sortable: undefined,\n resizable: undefined,\n singleClickEdit: undefined,\n floatingFilter: undefined,\n cellEditorPopup: undefined,\n suppressFillHandle: undefined,\n wrapHeaderText: undefined,\n autoHeaderHeight: undefined,\n dndSourceOnRowDrag: undefined,\n valueGetter: undefined,\n valueSetter: undefined,\n filterValueGetter: undefined,\n keyCreator: undefined,\n valueFormatter: undefined,\n valueParser: undefined,\n comparator: undefined,\n equals: undefined,\n pivotComparator: undefined,\n suppressKeyboardEvent: undefined,\n suppressHeaderKeyboardEvent: undefined,\n colSpan: undefined,\n rowSpan: undefined,\n getQuickFilterText: undefined,\n onCellValueChanged: undefined,\n onCellClicked: undefined,\n onCellDoubleClicked: undefined,\n onCellContextMenu: undefined,\n rowDragText: undefined,\n tooltipValueGetter: undefined,\n cellRendererSelector: undefined,\n cellEditorSelector: undefined,\n suppressSpanHeaderHeight: undefined,\n useValueFormatterForExport: undefined,\n useValueParserForImport: undefined,\n};\nColDefUtil.ALL_PROPERTIES = Object.keys(ColDefUtil.ColDefPropertyMap);\n","/**\n * These keys are used for validating properties supplied on a gridOptions object, and for code generation.\n * If you change the properties on the gridOptions interface, you *must* update this file as well to be consistent.\n */\nexport class PropertyKeys {\n}\nPropertyKeys.STRING_PROPERTIES = [\n 'rowSelection', 'overlayLoadingTemplate', 'overlayNoRowsTemplate', 'gridId',\n 'quickFilterText', 'rowModelType', 'editType', 'domLayout', 'clipboardDelimiter', 'rowGroupPanelShow',\n 'multiSortKey', 'pivotColumnGroupTotals', 'pivotRowTotals', 'pivotPanelShow', 'fillHandleDirection',\n 'serverSideStoreType', 'groupDisplayType', 'treeDataDisplayType', 'colResizeDefault', 'tooltipTrigger',\n 'serverSidePivotResultFieldSeparator',\n];\nPropertyKeys.OBJECT_PROPERTIES = [\n 'components', 'rowStyle', 'context', 'autoGroupColumnDef', 'localeText', 'icons',\n 'datasource', 'serverSideDatasource', 'viewportDatasource', 'groupRowRendererParams', 'aggFuncs', 'fullWidthCellRendererParams',\n 'defaultColGroupDef', 'defaultColDef', 'defaultCsvExportParams', 'defaultExcelExportParams', 'columnTypes',\n 'rowClassRules', 'detailCellRendererParams', 'loadingCellRendererParams', 'loadingOverlayComponentParams',\n 'noRowsOverlayComponentParams', 'popupParent', 'statusBar', 'sideBar', 'chartThemeOverrides',\n 'customChartThemes', 'chartToolPanelsDef', 'dataTypeDefinitions', 'advancedFilterModel', 'advancedFilterParent'\n];\nPropertyKeys.ARRAY_PROPERTIES = [\n 'sortingOrder', 'alignedGrids', 'rowData', 'columnDefs', 'excelStyles', 'pinnedTopRowData', 'pinnedBottomRowData', 'chartThemes', 'rowClass',\n];\nPropertyKeys.NUMBER_PROPERTIES = [\n 'rowHeight', 'detailRowHeight', 'rowBuffer', 'headerHeight', 'groupHeaderHeight', 'floatingFiltersHeight',\n 'pivotHeaderHeight', 'pivotGroupHeaderHeight', 'groupDefaultExpanded', 'pivotDefaultExpanded', 'viewportRowModelPageSize',\n 'viewportRowModelBufferSize', 'autoSizePadding', 'maxBlocksInCache', 'maxConcurrentDatasourceRequests', 'tooltipShowDelay',\n 'tooltipHideDelay', 'cacheOverflowSize', 'paginationPageSize', 'cacheBlockSize', 'infiniteInitialRowCount', 'serverSideInitialRowCount', 'scrollbarWidth',\n 'asyncTransactionWaitMillis', 'blockLoadDebounceMillis', 'keepDetailRowsCount',\n 'undoRedoCellEditingLimit', 'cellFlashDelay', 'cellFadeDelay', 'tabIndex'\n];\nPropertyKeys.BOOLEAN_PROPERTIES = [\n 'suppressMakeColumnVisibleAfterUnGroup', 'suppressRowClickSelection', 'suppressCellFocus', 'suppressHorizontalScroll',\n 'alwaysShowHorizontalScroll', 'alwaysShowVerticalScroll', 'debug', 'enableBrowserTooltips', 'enableCellExpressions', 'groupSelectsChildren',\n 'groupIncludeFooter', 'groupIncludeTotalFooter', 'groupSuppressBlankHeader', 'suppressMenuHide', 'suppressRowDeselection', 'unSortIcon',\n 'suppressMultiSort', 'alwaysMultiSort', 'singleClickEdit', 'suppressLoadingOverlay', 'suppressNoRowsOverlay', 'suppressAutoSize',\n 'skipHeaderOnAutoSize', 'suppressParentsInRowNodes', 'suppressColumnMoveAnimation', 'suppressMovableColumns', 'suppressFieldDotNotation',\n 'enableRangeSelection', 'enableRangeHandle', 'enableFillHandle', 'suppressClearOnFillReduction', 'deltaSort', 'suppressTouch', 'suppressAsyncEvents',\n 'allowContextMenuWithControlKey', 'suppressContextMenu', 'rememberGroupStateWhenNewData', 'enableCellChangeFlash', 'suppressDragLeaveHidesColumns',\n 'suppressRowGroupHidesColumns', 'suppressMiddleClickScrolls', 'suppressPreventDefaultOnMouseWheel', 'suppressCopyRowsToClipboard', 'copyHeadersToClipboard',\n 'copyGroupHeadersToClipboard', 'pivotMode', 'suppressAggFuncInHeader', 'suppressColumnVirtualisation', 'alwaysAggregateAtRootLevel', 'suppressAggAtRootLevel',\n 'suppressFocusAfterRefresh', 'functionsPassive', 'functionsReadOnly', 'animateRows', 'groupSelectsFiltered', 'groupRemoveSingleChildren',\n 'groupRemoveLowestSingleChildren', 'enableRtl', 'suppressClickEdit', 'rowDragEntireRow', 'rowDragManaged', 'suppressRowDrag', 'suppressMoveWhenRowDragging',\n 'rowDragMultiRow', 'enableGroupEdit', 'embedFullWidthRows', 'suppressPaginationPanel', 'groupHideOpenParents', 'groupAllowUnbalanced', 'pagination',\n 'paginationAutoPageSize', 'suppressScrollOnNewData', 'suppressScrollWhenPopupsAreOpen', 'purgeClosedRowNodes', 'cacheQuickFilter', 'includeHiddenColumnsInQuickFilter',\n 'excludeHiddenColumnsFromQuickFilter', 'ensureDomOrder', 'accentedSort', 'suppressChangeDetection', 'valueCache', 'valueCacheNeverExpires', 'aggregateOnlyChangedColumns',\n 'suppressAnimationFrame', 'suppressExcelExport', 'suppressCsvExport', 'treeData', 'masterDetail', 'suppressMultiRangeSelection', 'enterMovesDown',\n 'enterMovesDownAfterEdit', 'enterNavigatesVerticallyAfterEdit', 'enterNavigatesVertically', 'suppressPropertyNamesCheck', 'rowMultiSelectWithClick',\n 'suppressRowHoverHighlight', 'suppressRowTransform', 'suppressClipboardPaste', 'suppressLastEmptyLineOnPaste', 'enableCharts', 'enableChartToolPanelsButton',\n 'suppressChartToolPanelsButton', 'suppressMaintainUnsortedOrder', 'enableCellTextSelection', 'suppressBrowserResizeObserver', 'suppressMaxRenderedRowRestriction',\n 'excludeChildrenWhenTreeDataFiltering', 'tooltipMouseTrack', 'tooltipInteraction', 'keepDetailRows', 'paginateChildRows', 'preventDefaultOnContextMenu',\n 'undoRedoCellEditing', 'allowDragFromColumnsToolPanel', 'pivotSuppressAutoColumn', 'suppressExpandablePivotGroups', 'debounceVerticalScrollbar', 'detailRowAutoHeight',\n 'serverSideFilteringAlwaysResets', 'serverSideFilterAllLevels', 'serverSideSortingAlwaysResets', 'serverSideSortAllLevels', 'serverSideOnlyRefreshFilteredGroups',\n 'serverSideSortOnServer', 'serverSideFilterOnServer', 'suppressAggFilteredOnly', 'showOpenedGroup', 'suppressClipboardApi', 'suppressModelUpdateAfterUpdateTransaction',\n 'stopEditingWhenCellsLoseFocus', 'maintainColumnOrder', 'groupMaintainOrder', 'columnHoverHighlight', 'suppressReactUi', 'readOnlyEdit', 'suppressRowVirtualisation',\n 'enableCellEditingOnBackspace', 'resetRowDataOnUpdate', 'removePivotHeaderRowWhenSingleValueColumn', 'suppressCopySingleCellRanges', 'suppressGroupRowsSticky',\n 'suppressServerSideInfiniteScroll', 'rowGroupPanelSuppressSort', 'allowShowChangeAfterFilter', 'suppressCutToClipboard', 'enableAdvancedFilter',\n 'includeHiddenColumnsInAdvancedFilter',\n];\n/** You do not need to include event callbacks in this list, as they are generated automatically. */\nPropertyKeys.FUNCTIONAL_PROPERTIES = [\n 'doesExternalFilterPass', 'processSecondaryColDef', 'processSecondaryColGroupDef', 'processPivotResultColDef',\n 'processPivotResultColGroupDef', 'getBusinessKeyForNode', 'isRowSelectable', 'rowDragText',\n 'groupRowRenderer', 'fullWidthCellRenderer',\n 'loadingCellRenderer', 'loadingOverlayComponent', 'noRowsOverlayComponent',\n 'detailCellRenderer'\n];\nPropertyKeys.CALLBACK_PROPERTIES = [\n 'getLocaleText', 'isExternalFilterPresent', 'getRowHeight', 'getRowClass', 'getRowStyle', 'getContextMenuItems', 'getMainMenuItems',\n 'processRowPostCreate', 'processCellForClipboard', 'getGroupRowAgg', 'isFullWidthRow',\n 'sendToClipboard', 'navigateToNextHeader', 'tabToNextHeader', 'navigateToNextCell',\n 'tabToNextCell', 'processCellFromClipboard', 'getDocument', 'postProcessPopup', 'getChildCount', 'getDataPath', 'isRowMaster', 'postSortRows', 'processHeaderForClipboard',\n 'processGroupHeaderForClipboard', 'paginationNumberFormatter', 'processDataFromClipboard', 'getServerSideGroupKey', 'isServerSideGroup',\n 'createChartContainer', 'getChartToolbarItems', 'fillOperation', 'isApplyServerSideTransaction', 'getServerSideStoreParams', 'getServerSideGroupLevelParams',\n 'isServerSideGroupOpenByDefault', 'isGroupOpenByDefault', 'initialGroupOrderComparator',\n 'loadingCellRendererSelector', 'getRowId', 'groupAggFiltering'\n];\nPropertyKeys.FUNCTION_PROPERTIES = [\n ...PropertyKeys.FUNCTIONAL_PROPERTIES,\n ...PropertyKeys.CALLBACK_PROPERTIES\n];\nPropertyKeys.ALL_PROPERTIES = [\n ...PropertyKeys.ARRAY_PROPERTIES,\n ...PropertyKeys.OBJECT_PROPERTIES,\n ...PropertyKeys.STRING_PROPERTIES,\n ...PropertyKeys.NUMBER_PROPERTIES,\n ...PropertyKeys.FUNCTION_PROPERTIES,\n ...PropertyKeys.BOOLEAN_PROPERTIES\n];\n","import { Events } from '../events.mjs';\nimport { PropertyKeys } from '../propertyKeys.mjs';\nimport { iterateObject } from '../utils/object.mjs';\nimport { includes } from '../utils/array.mjs';\nimport { values } from '../utils/generic.mjs';\nexport class ComponentUtil {\n static getCallbackForEvent(eventName) {\n if (!eventName || eventName.length < 2) {\n return eventName;\n }\n return 'on' + eventName[0].toUpperCase() + eventName.substr(1);\n }\n static getCoercionLookup() {\n let coercionLookup = {};\n [\n ...ComponentUtil.ARRAY_PROPERTIES,\n ...ComponentUtil.OBJECT_PROPERTIES,\n ...ComponentUtil.STRING_PROPERTIES,\n ...ComponentUtil.FUNCTION_PROPERTIES,\n ...ComponentUtil.EVENT_CALLBACKS,\n ]\n .forEach((key) => coercionLookup[key] = 'none');\n ComponentUtil.BOOLEAN_PROPERTIES\n .forEach(key => coercionLookup[key] = 'boolean');\n ComponentUtil.NUMBER_PROPERTIES\n .forEach(key => coercionLookup[key] = 'number');\n return coercionLookup;\n }\n static getValue(key, rawValue) {\n const coercionStep = ComponentUtil.coercionLookup[key];\n if (coercionStep) {\n let newValue = rawValue;\n switch (coercionStep) {\n case 'number': {\n newValue = ComponentUtil.toNumber(rawValue);\n break;\n }\n case 'boolean': {\n newValue = ComponentUtil.toBoolean(rawValue);\n break;\n }\n case 'none': {\n // if groupAggFiltering exists and isn't a function, handle as a boolean.\n if (key === 'groupAggFiltering' && typeof rawValue !== 'function') {\n newValue = ComponentUtil.toBoolean(rawValue);\n }\n break;\n }\n }\n return newValue;\n }\n return undefined;\n }\n static getGridOptionKeys(component, isVue) {\n // Vue does not have keys in prod so instead need to run through all the \n // gridOptions checking for presence of a gridOption key.\n return isVue\n ? Object.keys(ComponentUtil.coercionLookup)\n : Object.keys(component);\n }\n static copyAttributesToGridOptions(gridOptions, component, isVue = false) {\n // create empty grid options if none were passed\n if (typeof gridOptions !== 'object') {\n gridOptions = {};\n }\n // to allow array style lookup in TypeScript, take type away from 'this' and 'gridOptions'\n const pGridOptions = gridOptions;\n const keys = ComponentUtil.getGridOptionKeys(component, isVue);\n // Loop through component props, if they are not undefined and a valid gridOption copy to gridOptions\n keys.forEach(key => {\n const value = component[key];\n if (typeof value !== 'undefined') {\n const coercedValue = ComponentUtil.getValue(key, value);\n if (coercedValue !== undefined) {\n pGridOptions[key] = coercedValue;\n }\n }\n });\n return gridOptions;\n }\n static processOnChange(changes, api) {\n if (!changes || Object.keys(changes).length === 0) {\n return;\n }\n const changesToApply = Object.assign({}, changes);\n // We manually call these updates so that we can provide a different source of gridOptionsChanged\n // We do not call setProperty as this will be called by the grid api methods\n if (changesToApply.columnTypes) {\n api.setColumnTypes(changesToApply.columnTypes.currentValue, \"gridOptionsChanged\");\n delete changesToApply.columnTypes;\n }\n if (changesToApply.autoGroupColumnDef) {\n api.setAutoGroupColumnDef(changesToApply.autoGroupColumnDef.currentValue, \"gridOptionsChanged\");\n delete changesToApply.autoGroupColumnDef;\n }\n if (changesToApply.defaultColDef) {\n api.setDefaultColDef(changesToApply.defaultColDef.currentValue, \"gridOptionsChanged\");\n delete changesToApply.defaultColDef;\n }\n if (changesToApply.columnDefs) {\n api.setColumnDefs(changesToApply.columnDefs.currentValue, \"gridOptionsChanged\");\n delete changesToApply.columnDefs;\n }\n Object.keys(changesToApply).forEach(key => {\n const gridKey = key;\n const coercedValue = ComponentUtil.getValue(gridKey, changesToApply[gridKey].currentValue);\n api.__setProperty(gridKey, coercedValue);\n });\n // copy changes into an event for dispatch\n const event = {\n type: Events.EVENT_COMPONENT_STATE_CHANGED\n };\n iterateObject(changes, (key, value) => {\n event[key] = value;\n });\n api.dispatchEvent(event);\n }\n static toBoolean(value) {\n if (typeof value === 'boolean') {\n return value;\n }\n if (typeof value === 'string') {\n // for boolean, compare to empty String to allow attributes appearing with\n // no value to be treated as 'true'\n return value.toUpperCase() === 'TRUE' || value == '';\n }\n return false;\n }\n static toNumber(value) {\n if (typeof value === 'number') {\n return value;\n }\n if (typeof value === 'string') {\n return Number(value);\n }\n }\n}\n// all events\nComponentUtil.EVENTS = values(Events);\n// events that are internal to AG Grid and should not be exposed to users via documentation or generated framework components\n/** Exclude the following internal events from code generation to prevent exposing these events via framework components */\nComponentUtil.EXCLUDED_INTERNAL_EVENTS = [\n Events.EVENT_SCROLLBAR_WIDTH_CHANGED,\n Events.EVENT_CHECKBOX_CHANGED,\n Events.EVENT_HEIGHT_SCALE_CHANGED,\n Events.EVENT_BODY_HEIGHT_CHANGED,\n Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED,\n Events.EVENT_SCROLL_VISIBILITY_CHANGED,\n Events.EVENT_COLUMN_HOVER_CHANGED,\n Events.EVENT_FLASH_CELLS,\n Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED,\n Events.EVENT_DISPLAYED_ROWS_CHANGED,\n Events.EVENT_LEFT_PINNED_WIDTH_CHANGED,\n Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED,\n Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED,\n Events.EVENT_POPUP_TO_FRONT,\n Events.EVENT_KEYBOARD_FOCUS,\n Events.EVENT_MOUSE_FOCUS,\n Events.EVENT_STORE_UPDATED,\n Events.EVENT_COLUMN_PANEL_ITEM_DRAG_START,\n Events.EVENT_COLUMN_PANEL_ITEM_DRAG_END,\n Events.EVENT_FILL_START,\n Events.EVENT_FILL_END,\n Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_START,\n Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_END,\n Events.EVENT_FULL_WIDTH_ROW_FOCUSED,\n Events.EVENT_HEADER_HEIGHT_CHANGED,\n Events.EVENT_COLUMN_HEADER_HEIGHT_CHANGED,\n Events.EVENT_CELL_FOCUS_CLEARED,\n Events.EVENT_GRID_STYLES_CHANGED,\n Events.EVENT_FILTER_DESTROYED,\n Events.EVENT_ROW_DATA_UPDATE_STARTED,\n Events.EVENT_ADVANCED_FILTER_ENABLED_CHANGED,\n Events.EVENT_DATA_TYPES_INFERRED,\n Events.EVENT_FIELD_VALUE_CHANGED,\n Events.EVENT_FIELD_PICKER_VALUE_SELECTED\n];\n// events that are available for use by users of AG Grid and so should be documented\n/** EVENTS that should be exposed via code generation for the framework components. */\nComponentUtil.PUBLIC_EVENTS = ComponentUtil.EVENTS.filter(e => !includes(ComponentUtil.EXCLUDED_INTERNAL_EVENTS, e));\n// onXXX methods, based on the above events\nComponentUtil.EVENT_CALLBACKS = ComponentUtil.EVENTS.map(event => ComponentUtil.getCallbackForEvent(event));\nComponentUtil.STRING_PROPERTIES = PropertyKeys.STRING_PROPERTIES;\nComponentUtil.OBJECT_PROPERTIES = PropertyKeys.OBJECT_PROPERTIES;\nComponentUtil.ARRAY_PROPERTIES = PropertyKeys.ARRAY_PROPERTIES;\nComponentUtil.NUMBER_PROPERTIES = PropertyKeys.NUMBER_PROPERTIES;\nComponentUtil.BOOLEAN_PROPERTIES = PropertyKeys.BOOLEAN_PROPERTIES;\nComponentUtil.FUNCTION_PROPERTIES = PropertyKeys.FUNCTION_PROPERTIES;\nComponentUtil.ALL_PROPERTIES = PropertyKeys.ALL_PROPERTIES;\nComponentUtil.ALL_PROPERTIES_SET = new Set(PropertyKeys.ALL_PROPERTIES);\nComponentUtil.coercionLookup = ComponentUtil.getCoercionLookup();\n","export function fuzzyCheckStrings(inputValues, validValues, allSuggestions) {\n const fuzzyMatches = {};\n const invalidInputs = inputValues.filter(inputValue => !validValues.some((validValue) => validValue === inputValue));\n if (invalidInputs.length > 0) {\n invalidInputs.forEach(invalidInput => fuzzyMatches[invalidInput] = fuzzySuggestions(invalidInput, allSuggestions));\n }\n return fuzzyMatches;\n}\n/**\n *\n * @param {String} inputValue The value to be compared against a list of strings\n * @param allSuggestions The list of strings to be compared against\n */\nexport function fuzzySuggestions(inputValue, allSuggestions, hideIrrelevant, filterByPercentageOfBestMatch) {\n let thisSuggestions = allSuggestions.map((text) => ({\n value: text,\n relevance: stringWeightedDistances(inputValue.toLowerCase(), text.toLocaleLowerCase())\n }));\n thisSuggestions.sort((a, b) => b.relevance - a.relevance);\n if (hideIrrelevant) {\n thisSuggestions = thisSuggestions.filter(suggestion => suggestion.relevance !== 0);\n }\n if (thisSuggestions.length > 0 && filterByPercentageOfBestMatch && filterByPercentageOfBestMatch > 0) {\n const bestMatch = thisSuggestions[0].relevance;\n const limit = bestMatch * filterByPercentageOfBestMatch;\n thisSuggestions = thisSuggestions.filter(suggestion => limit - suggestion.relevance < 0);\n }\n return thisSuggestions.map(suggestion => suggestion.value);\n}\nfunction stringWeightedDistances(str1, str2) {\n const a = str1.replace(/\\s/g, '');\n const b = str2.replace(/\\s/g, '');\n let weight = 0;\n let lastIndex = -1;\n for (let i = 0; i < a.length; i++) {\n const idx = b.indexOf(a[i], lastIndex + 1);\n if (idx === -1) {\n continue;\n }\n lastIndex = idx;\n weight += (100 - (lastIndex * 100 / 10000) * 100);\n }\n return weight;\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { ColDefUtil } from './components/colDefUtil.mjs';\nimport { ComponentUtil } from './components/componentUtil.mjs';\nimport { Autowired, Bean, PostConstruct } from './context/context.mjs';\nimport { ModuleNames } from './modules/moduleNames.mjs';\nimport { ModuleRegistry } from './modules/moduleRegistry.mjs';\nimport { PropertyKeys } from './propertyKeys.mjs';\nimport { doOnce } from './utils/function.mjs';\nimport { fuzzyCheckStrings } from './utils/fuzzyMatch.mjs';\nimport { iterateObject } from './utils/object.mjs';\nexport function logDeprecation(version, oldProp, newProp, message) {\n const newPropMsg = newProp ? `Please use '${newProp}' instead. ` : '';\n doOnce(() => console.warn(`AG Grid: since v${version}, '${oldProp}' is deprecated. ${newPropMsg}${message !== null && message !== void 0 ? message : ''}`), `Deprecated_${oldProp}`);\n}\n// Vue adds these properties to all objects, so we ignore them when checking for invalid properties\nconst VUE_FRAMEWORK_PROPS = ['__ob__', '__v_skip', '__metadata__'];\nlet GridOptionsValidator = class GridOptionsValidator {\n constructor() {\n this.deprecatedProperties = {\n rememberGroupStateWhenNewData: { version: '24', message: 'Now that transaction updates are possible and they keep group state, this feature is no longer needed.' },\n serverSideFilteringAlwaysResets: { version: '28.0', newProp: 'serverSideOnlyRefreshFilteredGroups', copyToNewProp: true, },\n serverSideSortingAlwaysResets: { version: '28.0', newProp: 'serverSideSortAllLevels', copyToNewProp: true, },\n suppressReactUi: { version: '28', message: 'The legacy React rendering engine is deprecated and will be removed in the next major version of the grid.' },\n processSecondaryColDef: { version: '28', newProp: 'processPivotResultColDef', copyToNewProp: true },\n processSecondaryColGroupDef: { version: '28', newProp: 'processPivotResultColGroupDef', copyToNewProp: true },\n getServerSideStoreParams: { version: '28', newProp: 'getServerSideGroupLevelParams', copyToNewProp: true },\n serverSideInfiniteScroll: { version: '29', message: 'Infinite Scrolling is now the default behaviour. This can be suppressed with `suppressServerSideInfiniteScroll`.' },\n enableChartToolPanelsButton: { version: '29', message: 'The Chart Tool Panels button is now enabled by default. To hide the Chart Tool Panels button and display the hamburger button instead, set suppressChartToolPanelsButton=true.' },\n functionsPassive: { version: '29.2' },\n onColumnRowGroupChangeRequest: { version: '29.2' },\n onColumnPivotChangeRequest: { version: '29.2' },\n onColumnValueChangeRequest: { version: '29.2' },\n onColumnAggFuncChangeRequest: { version: '29.2' },\n serverSideFilterAllLevels: { version: '30', message: 'All server-side group levels are now filtered by default. This can be toggled using `serverSideOnlyRefreshFilteredGroups`.' },\n suppressAggAtRootLevel: { version: '30', message: 'The root level aggregation is now suppressed by default. This can be toggled using `alwaysAggregateAtRootLevel`.' },\n excludeHiddenColumnsFromQuickFilter: { version: '30', message: 'Hidden columns are now excluded from the Quick Filter by default. This can be toggled using `includeHiddenColumnsInQuickFilter`.' },\n enterMovesDown: { version: '30', newProp: 'enterNavigatesVertically', copyToNewProp: true },\n enterMovesDownAfterEdit: { version: '30', newProp: 'enterNavigatesVerticallyAfterEdit', copyToNewProp: true },\n };\n }\n pickOneWarning(prop1, prop2) {\n console.warn(`AG Grid: ${prop1} and ${prop2} do not work with each other, you need to pick one.`);\n }\n init() {\n this.checkForDeprecated();\n this.checkForViolations();\n if (this.gridOptions.suppressPropertyNamesCheck !== true) {\n this.checkGridOptionsProperties();\n this.checkColumnDefProperties();\n }\n this.checkColumnDefViolations();\n if (this.gridOptionsService.is('groupSelectsChildren') && this.gridOptionsService.is('suppressParentsInRowNodes')) {\n console.warn(\"AG Grid: 'groupSelectsChildren' does not work with 'suppressParentsInRowNodes', this selection method needs the part in rowNode to work\");\n }\n if (this.gridOptionsService.is('groupSelectsChildren')) {\n if (this.gridOptionsService.get('rowSelection') !== 'multiple') {\n console.warn(\"AG Grid: rowSelection must be 'multiple' for groupSelectsChildren to make sense\");\n }\n }\n if (this.gridOptionsService.is('groupRemoveSingleChildren') && this.gridOptionsService.is('groupHideOpenParents')) {\n this.pickOneWarning('groupRemoveSingleChildren', 'groupHideOpenParents');\n }\n if (this.gridOptionsService.isRowModelType('serverSide')) {\n const msg = (prop, alt) => (`AG Grid: '${prop}' is not supported on the Server-Side Row Model.` + (alt ? ` Please use ${alt} instead.` : ''));\n if (this.gridOptionsService.exists('groupDefaultExpanded')) {\n console.warn(msg('groupDefaultExpanded', 'isServerSideGroupOpenByDefault callback'));\n }\n if (this.gridOptionsService.exists('groupIncludeFooter') && this.gridOptionsService.is('suppressServerSideInfiniteScroll')) {\n console.warn(msg('groupIncludeFooter'));\n }\n if (this.gridOptionsService.exists('groupIncludeTotalFooter')) {\n console.warn(msg('groupIncludeTotalFooter'));\n }\n }\n if (this.gridOptionsService.is('enableRangeSelection')) {\n ModuleRegistry.__assertRegistered(ModuleNames.RangeSelectionModule, 'enableRangeSelection', this.gridOptionsService.getGridId());\n }\n else if (this.gridOptionsService.is('enableRangeHandle') || this.gridOptionsService.is('enableFillHandle')) {\n console.warn(\"AG Grid: 'enableRangeHandle' or 'enableFillHandle' will not work unless 'enableRangeSelection' is set to true\");\n }\n const validateRegistered = (prop, module) => this.gridOptionsService.exists(prop) && ModuleRegistry.__assertRegistered(module, prop, this.gridOptionsService.getGridId());\n // Ensure the SideBar is registered which will then lead them to register Column / Filter Tool panels as required by their config.\n // It is possible to use the SideBar only with your own custom tool panels.\n validateRegistered('sideBar', ModuleNames.SideBarModule);\n validateRegistered('statusBar', ModuleNames.StatusBarModule);\n validateRegistered('enableCharts', ModuleNames.GridChartsModule);\n validateRegistered('getMainMenuItems', ModuleNames.MenuModule);\n validateRegistered('getContextMenuItems', ModuleNames.MenuModule);\n validateRegistered('allowContextMenuWithControlKey', ModuleNames.MenuModule);\n validateRegistered('enableAdvancedFilter', ModuleNames.AdvancedFilterModule);\n }\n checkColumnDefProperties() {\n if (this.gridOptions.columnDefs == null) {\n return;\n }\n const validProperties = ColDefUtil.ALL_PROPERTIES;\n const validateColDef = (colDef, propertyName) => {\n const userProperties = Object.getOwnPropertyNames(colDef);\n this.checkProperties(userProperties, [...validProperties, ...VUE_FRAMEWORK_PROPS], validProperties, propertyName, 'https://www.ag-grid.com/javascript-data-grid/column-properties/');\n if (colDef.children) {\n colDef.children.forEach(child => validateColDef(child, 'columnDefs.children'));\n }\n };\n this.gridOptions.columnDefs.forEach(colDef => validateColDef(colDef, 'columnDefs'));\n if (this.gridOptions.defaultColDef) {\n validateColDef(this.gridOptions.defaultColDef, 'defaultColDef');\n }\n }\n checkColumnDefViolations() {\n var _a;\n const rowModel = (_a = this.gridOptionsService.get('rowModelType')) !== null && _a !== void 0 ? _a : 'clientSide';\n const unsupportedPropertiesMap = {\n infinite: ['headerCheckboxSelection', 'headerCheckboxSelectionFilteredOnly', 'headerCheckboxSelectionCurrentPageOnly'],\n viewport: ['headerCheckboxSelection', 'headerCheckboxSelectionFilteredOnly', 'headerCheckboxSelectionCurrentPageOnly'],\n serverSide: ['headerCheckboxSelectionFilteredOnly', 'headerCheckboxSelectionCurrentPageOnly'],\n clientSide: [],\n };\n const unsupportedProperties = unsupportedPropertiesMap[rowModel];\n if (!(unsupportedProperties === null || unsupportedProperties === void 0 ? void 0 : unsupportedProperties.length)) {\n return;\n }\n const validateColDef = (colDef) => {\n unsupportedProperties.forEach(property => {\n if (property in colDef && !!colDef[property]) {\n console.warn(`AG Grid: Column property ${property} is not supported with the row model type ${rowModel}.`);\n }\n });\n };\n if (this.gridOptions.columnDefs != null) {\n this.gridOptions.columnDefs.forEach(colDef => validateColDef(colDef));\n }\n if (this.gridOptions.autoGroupColumnDef != null) {\n validateColDef(this.gridOptions.autoGroupColumnDef);\n }\n if (this.gridOptions.defaultColDef != null) {\n validateColDef(this.gridOptions.defaultColDef);\n }\n }\n checkGridOptionsProperties() {\n const userProperties = Object.getOwnPropertyNames(this.gridOptions);\n const validProperties = [\n ...PropertyKeys.ALL_PROPERTIES,\n ...ComponentUtil.EVENT_CALLBACKS\n ];\n const validPropertiesAndExceptions = [...validProperties, 'api', 'columnApi', ...VUE_FRAMEWORK_PROPS, ...Object.keys(this.deprecatedProperties)];\n this.checkProperties(userProperties, validPropertiesAndExceptions, validProperties, 'gridOptions', 'https://www.ag-grid.com/javascript-data-grid/grid-options/');\n }\n checkProperties(userProperties, validPropertiesAndExceptions, validProperties, containerName, docsUrl) {\n const invalidProperties = fuzzyCheckStrings(userProperties, validPropertiesAndExceptions, validProperties);\n iterateObject(invalidProperties, (key, value) => {\n doOnce(() => console.warn(`AG Grid: invalid ${containerName} property '${key}' did you mean any of these: ${value.slice(0, 8).join(\", \")}`), 'invalidProperty' + containerName + key);\n });\n if (Object.keys(invalidProperties).length > 0) {\n doOnce(() => console.warn(`AG Grid: to see all the valid ${containerName} properties please check: ${docsUrl}`), 'invalidProperties' + containerName + docsUrl);\n }\n }\n checkForDeprecated() {\n // casting to generic object, so typescript compiles even though\n // we are looking for attributes that don't exist\n const options = this.gridOptions;\n Object.entries(this.deprecatedProperties).forEach(([oldProp, details]) => {\n var _a;\n const oldPropValue = options[oldProp];\n if (oldPropValue) {\n logDeprecation(details.version, oldProp, details.newProp, details.message);\n if (details.copyToNewProp && details.newProp && options[details.newProp] == null) {\n options[details.newProp] = (_a = details.newPropValue) !== null && _a !== void 0 ? _a : oldPropValue;\n }\n }\n });\n // Manual messages and deprecation behaviour that don't fit our standard approach above.\n if (options.serverSideStoreType) {\n console.warn('AG Grid: since v29.0, `serverSideStoreType` has been replaced by `suppressServerSideInfiniteScroll`. Set to false to use Partial Store, and true to use Full Store.');\n options.suppressServerSideInfiniteScroll = options.serverSideStoreType !== 'partial';\n }\n }\n checkForViolations() {\n if (this.gridOptionsService.is('treeData')) {\n this.treeDataViolations();\n }\n }\n treeDataViolations() {\n if (this.gridOptionsService.isRowModelType('clientSide')) {\n if (!this.gridOptionsService.exists('getDataPath')) {\n console.warn('AG Grid: property usingTreeData=true with rowModel=clientSide, but you did not ' +\n 'provide getDataPath function, please provide getDataPath function if using tree data.');\n }\n }\n if (this.gridOptionsService.isRowModelType('serverSide')) {\n if (!this.gridOptionsService.exists('isServerSideGroup')) {\n console.warn('AG Grid: property usingTreeData=true with rowModel=serverSide, but you did not ' +\n 'provide isServerSideGroup function, please provide isServerSideGroup function if using tree data.');\n }\n if (!this.gridOptionsService.exists('getServerSideGroupKey')) {\n console.warn('AG Grid: property usingTreeData=true with rowModel=serverSide, but you did not ' +\n 'provide getServerSideGroupKey function, please provide getServerSideGroupKey function if using tree data.');\n }\n }\n }\n};\n__decorate([\n Autowired('gridOptions')\n], GridOptionsValidator.prototype, \"gridOptions\", void 0);\n__decorate([\n Autowired('gridOptionsService')\n], GridOptionsValidator.prototype, \"gridOptionsService\", void 0);\n__decorate([\n PostConstruct\n], GridOptionsValidator.prototype, \"init\", null);\nGridOptionsValidator = __decorate([\n Bean('gridOptionsValidator')\n], GridOptionsValidator);\nexport { GridOptionsValidator };\nexport function matchesGroupDisplayType(toMatch, supplied) {\n const groupDisplayTypeValues = ['groupRows', 'multipleColumns', 'custom', 'singleColumn'];\n if (groupDisplayTypeValues.indexOf(supplied) < 0) {\n console.warn(`AG Grid: '${supplied}' is not a valid groupDisplayType value - possible values are: '${groupDisplayTypeValues.join(\"', '\")}'`);\n return false;\n }\n return supplied === toMatch;\n}\nexport function matchesTreeDataDisplayType(toMatch, supplied) {\n const treeDataDisplayTypeValues = ['auto', 'custom'];\n if (treeDataDisplayTypeValues.indexOf(supplied) < 0) {\n console.warn(`AG Grid: '${supplied}' is not a valid treeDataDisplayType value - possible values are: '${treeDataDisplayTypeValues.join(\"', '\")}'`);\n return false;\n }\n return supplied === toMatch;\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { ColumnGroup } from '../entities/columnGroup.mjs';\nimport { Column } from '../entities/column.mjs';\nimport { Events } from '../events.mjs';\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { ProvidedColumnGroup } from '../entities/providedColumnGroup.mjs';\nimport { GroupInstanceIdCreator } from './groupInstanceIdCreator.mjs';\nimport { Autowired, Bean, Optional, PostConstruct, PreDestroy, Qualifier } from '../context/context.mjs';\nimport { GROUP_AUTO_COLUMN_ID } from './autoGroupColService.mjs';\nimport { areEqual, last, removeFromArray, moveInArray, includes, insertIntoArray, removeAllFromUnorderedArray, removeFromUnorderedArray } from '../utils/array.mjs';\nimport { missingOrEmpty, exists, missing, attrToBoolean, attrToNumber } from '../utils/generic.mjs';\nimport { camelCaseToHumanText } from '../utils/string.mjs';\nimport { convertToMap } from '../utils/map.mjs';\nimport { doOnce } from '../utils/function.mjs';\nimport { matchesGroupDisplayType, matchesTreeDataDisplayType } from '../gridOptionsValidator.mjs';\nlet ColumnModel = class ColumnModel extends BeanStub {\n constructor() {\n super(...arguments);\n // header row count, based on user provided columns\n this.primaryHeaderRowCount = 0;\n this.secondaryHeaderRowCount = 0;\n // header row count, either above, or based on pivoting if we are pivoting\n this.gridHeaderRowCount = 0;\n // leave level columns of the displayed trees\n this.displayedColumnsLeft = [];\n this.displayedColumnsRight = [];\n this.displayedColumnsCenter = [];\n // all three lists above combined\n this.displayedColumns = [];\n // for fast lookup, to see if a column or group is still displayed\n this.displayedColumnsAndGroupsMap = {};\n // all columns to be rendered\n this.viewportColumns = [];\n // A hash key to keep track of changes in viewport columns\n this.viewportColumnsHash = '';\n // same as viewportColumns, except we always include columns with headerAutoHeight\n this.headerViewportColumns = [];\n // all columns to be rendered in the centre\n this.viewportColumnsCenter = [];\n // same as viewportColumnsCenter, except we always include columns with headerAutoHeight\n this.headerViewportColumnsCenter = [];\n this.autoHeightActiveAtLeastOnce = false;\n this.rowGroupColumns = [];\n this.valueColumns = [];\n this.pivotColumns = [];\n this.ready = false;\n this.autoGroupsNeedBuilding = false;\n this.forceRecreateAutoGroups = false;\n this.pivotMode = false;\n this.bodyWidth = 0;\n this.leftWidth = 0;\n this.rightWidth = 0;\n this.bodyWidthDirty = true;\n // when we're waiting for cell data types to be inferred, we need to defer column resizing\n this.shouldQueueResizeOperations = false;\n this.resizeOperationQueue = [];\n }\n init() {\n this.suppressColumnVirtualisation = this.gridOptionsService.is('suppressColumnVirtualisation');\n const pivotMode = this.gridOptionsService.is('pivotMode');\n if (this.isPivotSettingAllowed(pivotMode)) {\n this.pivotMode = pivotMode;\n }\n this.usingTreeData = this.gridOptionsService.isTreeData();\n this.addManagedPropertyListener('groupDisplayType', () => this.onGroupDisplayTypeChanged());\n this.addManagedPropertyListener('autoGroupColumnDef', () => this.onAutoGroupColumnDefChanged());\n this.addManagedPropertyListener('defaultColDef', (params) => this.onSharedColDefChanged(params.source));\n this.addManagedPropertyListener('columnTypes', (params) => this.onSharedColDefChanged(params.source));\n }\n onGroupDisplayTypeChanged() {\n // Possible for update to be called before columns are present in which case there is nothing to do here.\n if (!this.columnDefs) {\n return;\n }\n this.autoGroupsNeedBuilding = true;\n this.forceRecreateAutoGroups = true;\n this.updateGridColumns();\n this.updateDisplayedColumns('gridOptionsChanged');\n }\n onAutoGroupColumnDefChanged() {\n if (this.groupAutoColumns) {\n this.autoGroupColService.updateAutoGroupColumns(this.groupAutoColumns);\n }\n }\n onSharedColDefChanged(source = 'api') {\n // if we aren't going to force, update the auto cols in place\n if (this.groupAutoColumns) {\n this.autoGroupColService.updateAutoGroupColumns(this.groupAutoColumns);\n }\n this.createColumnsFromColumnDefs(true, source);\n }\n setColumnDefs(columnDefs, source = 'api') {\n const colsPreviouslyExisted = !!this.columnDefs;\n this.columnDefs = columnDefs;\n this.createColumnsFromColumnDefs(colsPreviouslyExisted, source);\n }\n recreateColumnDefs(source = 'api') {\n this.onSharedColDefChanged(source);\n }\n destroyOldColumns(oldTree, newTree) {\n const oldObjectsById = {};\n if (!oldTree) {\n return;\n }\n // add in all old columns to be destroyed\n this.columnUtils.depthFirstOriginalTreeSearch(null, oldTree, child => {\n oldObjectsById[child.getInstanceId()] = child;\n });\n // however we don't destroy anything in the new tree. if destroying the grid, there is no new tree\n if (newTree) {\n this.columnUtils.depthFirstOriginalTreeSearch(null, newTree, child => {\n oldObjectsById[child.getInstanceId()] = null;\n });\n }\n // what's left can be destroyed\n const colsToDestroy = Object.values(oldObjectsById).filter(item => item != null);\n this.destroyBeans(colsToDestroy);\n }\n destroyColumns() {\n this.destroyOldColumns(this.primaryColumnTree);\n this.destroyOldColumns(this.secondaryBalancedTree);\n this.destroyOldColumns(this.groupAutoColsBalancedTree);\n }\n createColumnsFromColumnDefs(colsPreviouslyExisted, source = 'api') {\n // only need to dispatch before/after events if updating columns, never if setting columns for first time\n const dispatchEventsFunc = colsPreviouslyExisted ? this.compareColumnStatesAndDispatchEvents(source) : undefined;\n // always invalidate cache on changing columns, as the column id's for the new columns\n // could overlap with the old id's, so the cache would return old values for new columns.\n this.valueCache.expire();\n // NOTE ==================\n // we should be destroying the existing columns and groups if they exist, for example, the original column\n // group adds a listener to the columns, it should be also removing the listeners\n this.autoGroupsNeedBuilding = true;\n const oldPrimaryColumns = this.primaryColumns;\n const oldPrimaryTree = this.primaryColumnTree;\n const balancedTreeResult = this.columnFactory.createColumnTree(this.columnDefs, true, oldPrimaryTree);\n this.destroyOldColumns(this.primaryColumnTree, balancedTreeResult.columnTree);\n this.primaryColumnTree = balancedTreeResult.columnTree;\n this.primaryHeaderRowCount = balancedTreeResult.treeDept + 1;\n this.primaryColumns = this.getColumnsFromTree(this.primaryColumnTree);\n this.primaryColumnsMap = {};\n this.primaryColumns.forEach(col => this.primaryColumnsMap[col.getId()] = col);\n this.extractRowGroupColumns(source, oldPrimaryColumns);\n this.extractPivotColumns(source, oldPrimaryColumns);\n this.extractValueColumns(source, oldPrimaryColumns);\n this.ready = true;\n // if we are showing secondary columns, then no need to update grid columns\n // at this point, as it's the pivot service responsibility to change these\n // if we are no longer pivoting (ie and need to revert back to primary, otherwise\n // we shouldn't be touching the primary).\n const gridColsNotProcessed = this.gridColsArePrimary === undefined;\n const processGridCols = this.gridColsArePrimary || gridColsNotProcessed;\n if (processGridCols) {\n this.updateGridColumns();\n if (colsPreviouslyExisted && !this.gridOptionsService.is('maintainColumnOrder')) {\n this.orderGridColumnsLikePrimary();\n }\n this.updateDisplayedColumns(source);\n this.checkViewportColumns();\n }\n // this event is not used by AG Grid, but left here for backwards compatibility,\n // in case applications use it\n this.dispatchEverythingChanged(source);\n if (dispatchEventsFunc) {\n dispatchEventsFunc();\n }\n this.dispatchNewColumnsLoaded(source);\n }\n dispatchNewColumnsLoaded(source) {\n const newColumnsLoadedEvent = {\n type: Events.EVENT_NEW_COLUMNS_LOADED,\n source\n };\n this.eventService.dispatchEvent(newColumnsLoadedEvent);\n }\n // this event is legacy, no grid code listens to it. instead the grid listens to New Columns Loaded\n dispatchEverythingChanged(source = 'api') {\n const eventEverythingChanged = {\n type: Events.EVENT_COLUMN_EVERYTHING_CHANGED,\n source\n };\n this.eventService.dispatchEvent(eventEverythingChanged);\n }\n orderGridColumnsLikePrimary() {\n const primaryColumns = this.primaryColumns;\n if (!primaryColumns) {\n return;\n }\n const primaryColsOrdered = primaryColumns.filter(col => this.gridColumns.indexOf(col) >= 0);\n const otherCols = this.gridColumns.filter(col => primaryColsOrdered.indexOf(col) < 0);\n this.gridColumns = [...otherCols, ...primaryColsOrdered];\n this.gridColumns = this.placeLockedColumns(this.gridColumns);\n }\n getAllDisplayedAutoHeightCols() {\n return this.displayedAutoHeightCols;\n }\n setViewport() {\n if (this.gridOptionsService.is('enableRtl')) {\n this.viewportLeft = this.bodyWidth - this.scrollPosition - this.scrollWidth;\n this.viewportRight = this.bodyWidth - this.scrollPosition;\n }\n else {\n this.viewportLeft = this.scrollPosition;\n this.viewportRight = this.scrollWidth + this.scrollPosition;\n }\n }\n // used by clipboard service, to know what columns to paste into\n getDisplayedColumnsStartingAt(column) {\n let currentColumn = column;\n const columns = [];\n while (currentColumn != null) {\n columns.push(currentColumn);\n currentColumn = this.getDisplayedColAfter(currentColumn);\n }\n return columns;\n }\n // checks what columns are currently displayed due to column virtualisation. dispatches an event\n // if the list of columns has changed.\n // + setColumnWidth(), setViewportPosition(), setColumnDefs(), sizeColumnsToFit()\n checkViewportColumns() {\n // check displayCenterColumnTree exists first, as it won't exist when grid is initialising\n if (this.displayedColumnsCenter == null) {\n return;\n }\n const viewportColumnsChanged = this.extractViewport();\n if (!viewportColumnsChanged) {\n return;\n }\n const event = {\n type: Events.EVENT_VIRTUAL_COLUMNS_CHANGED\n };\n this.eventService.dispatchEvent(event);\n }\n setViewportPosition(scrollWidth, scrollPosition) {\n if (scrollWidth !== this.scrollWidth || scrollPosition !== this.scrollPosition || this.bodyWidthDirty) {\n this.scrollWidth = scrollWidth;\n this.scrollPosition = scrollPosition;\n // we need to call setVirtualViewportLeftAndRight() at least once after the body width changes,\n // as the viewport can stay the same, but in RTL, if body width changes, we need to work out the\n // virtual columns again\n this.bodyWidthDirty = true;\n this.setViewport();\n if (this.ready) {\n this.checkViewportColumns();\n }\n }\n }\n isPivotMode() {\n return this.pivotMode;\n }\n isPivotSettingAllowed(pivot) {\n if (pivot && this.gridOptionsService.isTreeData()) {\n console.warn(\"AG Grid: Pivot mode not available in conjunction Tree Data i.e. 'gridOptions.treeData: true'\");\n return false;\n }\n return true;\n }\n setPivotMode(pivotMode, source = 'api') {\n if (pivotMode === this.pivotMode || !this.isPivotSettingAllowed(this.pivotMode)) {\n return;\n }\n this.pivotMode = pivotMode;\n // we need to update grid columns to cover the scenario where user has groupDisplayType = 'custom', as\n // this means we don't use auto group column UNLESS we are in pivot mode (it's mandatory in pivot mode),\n // so need to updateGridColumn() to check it autoGroupCol needs to be added / removed\n this.autoGroupsNeedBuilding = true;\n this.updateGridColumns();\n this.updateDisplayedColumns(source);\n const event = {\n type: Events.EVENT_COLUMN_PIVOT_MODE_CHANGED\n };\n this.eventService.dispatchEvent(event);\n }\n getSecondaryPivotColumn(pivotKeys, valueColKey) {\n if (missing(this.secondaryColumns)) {\n return null;\n }\n const valueColumnToFind = this.getPrimaryColumn(valueColKey);\n let foundColumn = null;\n this.secondaryColumns.forEach(column => {\n const thisPivotKeys = column.getColDef().pivotKeys;\n const pivotValueColumn = column.getColDef().pivotValueColumn;\n const pivotKeyMatches = areEqual(thisPivotKeys, pivotKeys);\n const pivotValueMatches = pivotValueColumn === valueColumnToFind;\n if (pivotKeyMatches && pivotValueMatches) {\n foundColumn = column;\n }\n });\n return foundColumn;\n }\n setBeans(loggerFactory) {\n this.logger = loggerFactory.create('columnModel');\n }\n setFirstRightAndLastLeftPinned(source) {\n let lastLeft;\n let firstRight;\n if (this.gridOptionsService.is('enableRtl')) {\n lastLeft = this.displayedColumnsLeft ? this.displayedColumnsLeft[0] : null;\n firstRight = this.displayedColumnsRight ? last(this.displayedColumnsRight) : null;\n }\n else {\n lastLeft = this.displayedColumnsLeft ? last(this.displayedColumnsLeft) : null;\n firstRight = this.displayedColumnsRight ? this.displayedColumnsRight[0] : null;\n }\n this.gridColumns.forEach((column) => {\n column.setLastLeftPinned(column === lastLeft, source);\n column.setFirstRightPinned(column === firstRight, source);\n });\n }\n autoSizeColumns(params) {\n if (this.shouldQueueResizeOperations) {\n this.resizeOperationQueue.push(() => this.autoSizeColumns(params));\n return;\n }\n const { columns, skipHeader, skipHeaderGroups, stopAtGroup, source = 'api' } = params;\n // because of column virtualisation, we can only do this function on columns that are\n // actually rendered, as non-rendered columns (outside the viewport and not rendered\n // due to column virtualisation) are not present. this can result in all rendered columns\n // getting narrowed, which in turn introduces more rendered columns on the RHS which\n // did not get autosized in the original run, leaving the visible grid with columns on\n // the LHS sized, but RHS no. so we keep looping through the visible columns until\n // no more cols are available (rendered) to be resized\n // we autosize after animation frames finish in case any cell renderers need to complete first. this can\n // happen eg if client code is calling api.autoSizeAllColumns() straight after grid is initialised, but grid\n // hasn't fully drawn out all the cells yet (due to cell renderers in animation frames).\n this.animationFrameService.flushAllFrames();\n // keep track of which cols we have resized in here\n const columnsAutosized = [];\n // initialise with anything except 0 so that while loop executes at least once\n let changesThisTimeAround = -1;\n const shouldSkipHeader = skipHeader != null ? skipHeader : this.gridOptionsService.is('skipHeaderOnAutoSize');\n const shouldSkipHeaderGroups = skipHeaderGroups != null ? skipHeaderGroups : shouldSkipHeader;\n while (changesThisTimeAround !== 0) {\n changesThisTimeAround = 0;\n this.actionOnGridColumns(columns, (column) => {\n // if already autosized, skip it\n if (columnsAutosized.indexOf(column) >= 0) {\n return false;\n }\n // get how wide this col should be\n const preferredWidth = this.autoWidthCalculator.getPreferredWidthForColumn(column, shouldSkipHeader);\n // preferredWidth = -1 if this col is not on the screen\n if (preferredWidth > 0) {\n const newWidth = this.normaliseColumnWidth(column, preferredWidth);\n column.setActualWidth(newWidth, source);\n columnsAutosized.push(column);\n changesThisTimeAround++;\n }\n return true;\n }, source);\n }\n if (!shouldSkipHeaderGroups) {\n this.autoSizeColumnGroupsByColumns(columns, source, stopAtGroup);\n }\n this.dispatchColumnResizedEvent(columnsAutosized, true, 'autosizeColumns');\n }\n dispatchColumnResizedEvent(columns, finished, source, flexColumns = null) {\n if (columns && columns.length) {\n const event = {\n type: Events.EVENT_COLUMN_RESIZED,\n columns: columns,\n column: columns.length === 1 ? columns[0] : null,\n flexColumns: flexColumns,\n finished: finished,\n source: source\n };\n this.eventService.dispatchEvent(event);\n }\n }\n dispatchColumnChangedEvent(type, columns, source) {\n const event = {\n type: type,\n columns: columns,\n column: (columns && columns.length == 1) ? columns[0] : null,\n source: source\n };\n this.eventService.dispatchEvent(event);\n }\n dispatchColumnMovedEvent(params) {\n const { movedColumns, source, toIndex, finished } = params;\n const event = {\n type: Events.EVENT_COLUMN_MOVED,\n columns: movedColumns,\n column: movedColumns && movedColumns.length === 1 ? movedColumns[0] : null,\n toIndex,\n finished,\n source\n };\n this.eventService.dispatchEvent(event);\n }\n dispatchColumnPinnedEvent(changedColumns, source) {\n if (!changedColumns.length) {\n return;\n }\n // if just one column, we use this, otherwise we don't include the col\n const column = changedColumns.length === 1 ? changedColumns[0] : null;\n // only include visible if it's common in all columns\n const pinned = this.getCommonValue(changedColumns, col => col.getPinned());\n const event = {\n type: Events.EVENT_COLUMN_PINNED,\n // mistake in typing, 'undefined' should be allowed, as 'null' means 'not pinned'\n pinned: pinned != null ? pinned : null,\n columns: changedColumns,\n column,\n source: source\n };\n this.eventService.dispatchEvent(event);\n }\n dispatchColumnVisibleEvent(changedColumns, source) {\n if (!changedColumns.length) {\n return;\n }\n // if just one column, we use this, otherwise we don't include the col\n const column = changedColumns.length === 1 ? changedColumns[0] : null;\n // only include visible if it's common in all columns\n const visible = this.getCommonValue(changedColumns, col => col.isVisible());\n const event = {\n type: Events.EVENT_COLUMN_VISIBLE,\n visible,\n columns: changedColumns,\n column,\n source: source\n };\n this.eventService.dispatchEvent(event);\n }\n autoSizeColumn(key, skipHeader, source = \"api\") {\n if (key) {\n this.autoSizeColumns({ columns: [key], skipHeader, skipHeaderGroups: true, source });\n }\n }\n autoSizeColumnGroupsByColumns(keys, source, stopAtGroup) {\n const columnGroups = new Set();\n const columns = this.getGridColumns(keys);\n columns.forEach(col => {\n let parent = col.getParent();\n while (parent && parent != stopAtGroup) {\n if (!parent.isPadding()) {\n columnGroups.add(parent);\n }\n parent = parent.getParent();\n }\n });\n let headerGroupCtrl;\n const resizedColumns = [];\n for (const columnGroup of columnGroups) {\n for (const headerContainerCtrl of this.ctrlsService.getHeaderRowContainerCtrls()) {\n headerGroupCtrl = headerContainerCtrl.getHeaderCtrlForColumn(columnGroup);\n if (headerGroupCtrl) {\n break;\n }\n }\n if (headerGroupCtrl) {\n headerGroupCtrl.resizeLeafColumnsToFit(source);\n }\n }\n return resizedColumns;\n }\n autoSizeAllColumns(skipHeader, source = \"api\") {\n if (this.shouldQueueResizeOperations) {\n this.resizeOperationQueue.push(() => this.autoSizeAllColumns(skipHeader, source));\n return;\n }\n const allDisplayedColumns = this.getAllDisplayedColumns();\n this.autoSizeColumns({ columns: allDisplayedColumns, skipHeader, source });\n }\n // Possible candidate for reuse (alot of recursive traversal duplication)\n getColumnsFromTree(rootColumns) {\n const result = [];\n const recursiveFindColumns = (childColumns) => {\n for (let i = 0; i < childColumns.length; i++) {\n const child = childColumns[i];\n if (child instanceof Column) {\n result.push(child);\n }\n else if (child instanceof ProvidedColumnGroup) {\n recursiveFindColumns(child.getChildren());\n }\n }\n };\n recursiveFindColumns(rootColumns);\n return result;\n }\n getAllDisplayedTrees() {\n if (this.displayedTreeLeft && this.displayedTreeRight && this.displayedTreeCentre) {\n return this.displayedTreeLeft\n .concat(this.displayedTreeCentre)\n .concat(this.displayedTreeRight);\n }\n return null;\n }\n // + columnSelectPanel\n getPrimaryColumnTree() {\n return this.primaryColumnTree;\n }\n // + gridPanel -> for resizing the body and setting top margin\n getHeaderRowCount() {\n return this.gridHeaderRowCount;\n }\n // + headerRenderer -> setting pinned body width\n getDisplayedTreeLeft() {\n return this.displayedTreeLeft;\n }\n // + headerRenderer -> setting pinned body width\n getDisplayedTreeRight() {\n return this.displayedTreeRight;\n }\n // + headerRenderer -> setting pinned body width\n getDisplayedTreeCentre() {\n return this.displayedTreeCentre;\n }\n // gridPanel -> ensureColumnVisible\n isColumnDisplayed(column) {\n return this.getAllDisplayedColumns().indexOf(column) >= 0;\n }\n // + csvCreator\n getAllDisplayedColumns() {\n return this.displayedColumns;\n }\n getViewportColumns() {\n return this.viewportColumns;\n }\n getDisplayedLeftColumnsForRow(rowNode) {\n if (!this.colSpanActive) {\n return this.displayedColumnsLeft;\n }\n return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsLeft);\n }\n getDisplayedRightColumnsForRow(rowNode) {\n if (!this.colSpanActive) {\n return this.displayedColumnsRight;\n }\n return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsRight);\n }\n isColSpanActive() {\n return this.colSpanActive;\n }\n getDisplayedColumnsForRow(rowNode, displayedColumns, filterCallback, emptySpaceBeforeColumn) {\n const result = [];\n let lastConsideredCol = null;\n for (let i = 0; i < displayedColumns.length; i++) {\n const col = displayedColumns[i];\n const maxAllowedColSpan = displayedColumns.length - i;\n const colSpan = Math.min(col.getColSpan(rowNode), maxAllowedColSpan);\n const columnsToCheckFilter = [col];\n if (colSpan > 1) {\n const colsToRemove = colSpan - 1;\n for (let j = 1; j <= colsToRemove; j++) {\n columnsToCheckFilter.push(displayedColumns[i + j]);\n }\n i += colsToRemove;\n }\n // see which cols we should take out for column virtualisation\n let filterPasses;\n if (filterCallback) {\n // if user provided a callback, means some columns may not be in the viewport.\n // the user will NOT provide a callback if we are talking about pinned areas,\n // as pinned areas have no horizontal scroll and do not virtualise the columns.\n // if lots of columns, that means column spanning, and we set filterPasses = true\n // if one or more of the columns spanned pass the filter.\n filterPasses = false;\n columnsToCheckFilter.forEach(colForFilter => {\n if (filterCallback(colForFilter)) {\n filterPasses = true;\n }\n });\n }\n else {\n filterPasses = true;\n }\n if (filterPasses) {\n if (result.length === 0 && lastConsideredCol) {\n const gapBeforeColumn = emptySpaceBeforeColumn ? emptySpaceBeforeColumn(col) : false;\n if (gapBeforeColumn) {\n result.push(lastConsideredCol);\n }\n }\n result.push(col);\n }\n lastConsideredCol = col;\n }\n return result;\n }\n // + rowRenderer\n // if we are not column spanning, this just returns back the virtual centre columns,\n // however if we are column spanning, then different rows can have different virtual\n // columns, so we have to work out the list for each individual row.\n getViewportCenterColumnsForRow(rowNode) {\n if (!this.colSpanActive) {\n return this.viewportColumnsCenter;\n }\n const emptySpaceBeforeColumn = (col) => {\n const left = col.getLeft();\n return exists(left) && left > this.viewportLeft;\n };\n // if doing column virtualisation, then we filter based on the viewport.\n const filterCallback = this.suppressColumnVirtualisation ? null : this.isColumnInRowViewport.bind(this);\n return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsCenter, filterCallback, emptySpaceBeforeColumn);\n }\n getAriaColumnIndex(col) {\n return this.getAllGridColumns().indexOf(col) + 1;\n }\n isColumnInHeaderViewport(col) {\n // for headers, we never filter out autoHeaderHeight columns, if calculating\n if (col.isAutoHeaderHeight()) {\n return true;\n }\n return this.isColumnInRowViewport(col);\n }\n isColumnInRowViewport(col) {\n // we never filter out autoHeight columns, as we need them in the DOM for calculating Auto Height\n if (col.isAutoHeight()) {\n return true;\n }\n const columnLeft = col.getLeft() || 0;\n const columnRight = columnLeft + col.getActualWidth();\n // adding 200 for buffer size, so some cols off viewport are rendered.\n // this helps horizontal scrolling so user rarely sees white space (unless\n // they scroll horizontally fast). however we are conservative, as the more\n // buffer the slower the vertical redraw speed\n const leftBounds = this.viewportLeft - 200;\n const rightBounds = this.viewportRight + 200;\n const columnToMuchLeft = columnLeft < leftBounds && columnRight < leftBounds;\n const columnToMuchRight = columnLeft > rightBounds && columnRight > rightBounds;\n return !columnToMuchLeft && !columnToMuchRight;\n }\n // used by:\n // + angularGrid -> setting pinned body width\n // note: this should be cached\n getDisplayedColumnsLeftWidth() {\n return this.getWidthOfColsInList(this.displayedColumnsLeft);\n }\n // note: this should be cached\n getDisplayedColumnsRightWidth() {\n return this.getWidthOfColsInList(this.displayedColumnsRight);\n }\n updatePrimaryColumnList(keys, masterList, actionIsAdd, columnCallback, eventType, source = \"api\") {\n if (!keys || missingOrEmpty(keys)) {\n return;\n }\n let atLeastOne = false;\n keys.forEach(key => {\n const columnToAdd = this.getPrimaryColumn(key);\n if (!columnToAdd) {\n return;\n }\n if (actionIsAdd) {\n if (masterList.indexOf(columnToAdd) >= 0) {\n return;\n }\n masterList.push(columnToAdd);\n }\n else {\n if (masterList.indexOf(columnToAdd) < 0) {\n return;\n }\n removeFromArray(masterList, columnToAdd);\n }\n columnCallback(columnToAdd);\n atLeastOne = true;\n });\n if (!atLeastOne) {\n return;\n }\n if (this.autoGroupsNeedBuilding) {\n this.updateGridColumns();\n }\n this.updateDisplayedColumns(source);\n const event = {\n type: eventType,\n columns: masterList,\n column: masterList.length === 1 ? masterList[0] : null,\n source: source\n };\n this.eventService.dispatchEvent(event);\n }\n setRowGroupColumns(colKeys, source = \"api\") {\n this.autoGroupsNeedBuilding = true;\n this.setPrimaryColumnList(colKeys, this.rowGroupColumns, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, true, this.setRowGroupActive.bind(this), source);\n }\n setRowGroupActive(active, column, source) {\n if (active === column.isRowGroupActive()) {\n return;\n }\n column.setRowGroupActive(active, source);\n if (active && !this.gridOptionsService.is('suppressRowGroupHidesColumns')) {\n this.setColumnVisible(column, false, source);\n }\n if (!active && !this.gridOptionsService.is('suppressMakeColumnVisibleAfterUnGroup')) {\n this.setColumnVisible(column, true, source);\n }\n }\n addRowGroupColumn(key, source = \"api\") {\n if (key) {\n this.addRowGroupColumns([key], source);\n }\n }\n addRowGroupColumns(keys, source = \"api\") {\n this.autoGroupsNeedBuilding = true;\n this.updatePrimaryColumnList(keys, this.rowGroupColumns, true, this.setRowGroupActive.bind(this, true), Events.EVENT_COLUMN_ROW_GROUP_CHANGED, source);\n }\n removeRowGroupColumns(keys, source = \"api\") {\n this.autoGroupsNeedBuilding = true;\n this.updatePrimaryColumnList(keys, this.rowGroupColumns, false, this.setRowGroupActive.bind(this, false), Events.EVENT_COLUMN_ROW_GROUP_CHANGED, source);\n }\n removeRowGroupColumn(key, source = \"api\") {\n if (key) {\n this.removeRowGroupColumns([key], source);\n }\n }\n addPivotColumns(keys, source = \"api\") {\n this.updatePrimaryColumnList(keys, this.pivotColumns, true, column => column.setPivotActive(true, source), Events.EVENT_COLUMN_PIVOT_CHANGED, source);\n }\n setPivotColumns(colKeys, source = \"api\") {\n this.setPrimaryColumnList(colKeys, this.pivotColumns, Events.EVENT_COLUMN_PIVOT_CHANGED, true, (added, column) => {\n column.setPivotActive(added, source);\n }, source);\n }\n addPivotColumn(key, source = \"api\") {\n this.addPivotColumns([key], source);\n }\n removePivotColumns(keys, source = \"api\") {\n this.updatePrimaryColumnList(keys, this.pivotColumns, false, column => column.setPivotActive(false, source), Events.EVENT_COLUMN_PIVOT_CHANGED, source);\n }\n removePivotColumn(key, source = \"api\") {\n this.removePivotColumns([key], source);\n }\n setPrimaryColumnList(colKeys, masterList, eventName, detectOrderChange, columnCallback, source) {\n const changes = new Map();\n // store all original cols and their index.\n masterList.forEach((col, idx) => changes.set(col, idx));\n masterList.length = 0;\n if (exists(colKeys)) {\n colKeys.forEach(key => {\n const column = this.getPrimaryColumn(key);\n if (column) {\n masterList.push(column);\n }\n });\n }\n masterList.forEach((col, idx) => {\n const oldIndex = changes.get(col);\n // if the column was not in the list, we add it as it's a change\n // idx is irrelevant now.\n if (oldIndex === undefined) {\n changes.set(col, 0);\n return;\n }\n if (detectOrderChange && oldIndex !== idx) {\n // if we're detecting order changes, and the indexes differ, we retain this as it's changed\n return;\n }\n // otherwise remove this col, as it's unchanged.\n changes.delete(col);\n });\n (this.primaryColumns || []).forEach(column => {\n const added = masterList.indexOf(column) >= 0;\n columnCallback(added, column);\n });\n if (this.autoGroupsNeedBuilding) {\n this.updateGridColumns();\n }\n this.updateDisplayedColumns(source);\n this.dispatchColumnChangedEvent(eventName, [...changes.keys()], source);\n }\n setValueColumns(colKeys, source = \"api\") {\n this.setPrimaryColumnList(colKeys, this.valueColumns, Events.EVENT_COLUMN_VALUE_CHANGED, false, this.setValueActive.bind(this), source);\n }\n setValueActive(active, column, source) {\n if (active === column.isValueActive()) {\n return;\n }\n column.setValueActive(active, source);\n if (active && !column.getAggFunc()) {\n const initialAggFunc = this.aggFuncService.getDefaultAggFunc(column);\n column.setAggFunc(initialAggFunc);\n }\n }\n addValueColumns(keys, source = \"api\") {\n this.updatePrimaryColumnList(keys, this.valueColumns, true, this.setValueActive.bind(this, true), Events.EVENT_COLUMN_VALUE_CHANGED, source);\n }\n addValueColumn(colKey, source = \"api\") {\n if (colKey) {\n this.addValueColumns([colKey], source);\n }\n }\n removeValueColumn(colKey, source = \"api\") {\n this.removeValueColumns([colKey], source);\n }\n removeValueColumns(keys, source = \"api\") {\n this.updatePrimaryColumnList(keys, this.valueColumns, false, this.setValueActive.bind(this, false), Events.EVENT_COLUMN_VALUE_CHANGED, source);\n }\n // returns the width we can set to this col, taking into consideration min and max widths\n normaliseColumnWidth(column, newWidth) {\n const minWidth = column.getMinWidth();\n if (exists(minWidth) && newWidth < minWidth) {\n newWidth = minWidth;\n }\n const maxWidth = column.getMaxWidth();\n if (exists(maxWidth) && column.isGreaterThanMax(newWidth)) {\n newWidth = maxWidth;\n }\n return newWidth;\n }\n getPrimaryOrGridColumn(key) {\n const column = this.getPrimaryColumn(key);\n return column || this.getGridColumn(key);\n }\n setColumnWidths(columnWidths, shiftKey, // @takeFromAdjacent - if user has 'shift' pressed, then pixels are taken from adjacent column\n finished, // @finished - ends up in the event, tells the user if more events are to come\n source = \"api\") {\n const sets = [];\n columnWidths.forEach(columnWidth => {\n const col = this.getPrimaryOrGridColumn(columnWidth.key);\n if (!col) {\n return;\n }\n sets.push({\n width: columnWidth.newWidth,\n ratios: [1],\n columns: [col]\n });\n // if user wants to do shift resize by default, then we invert the shift operation\n const defaultIsShift = this.gridOptionsService.get('colResizeDefault') === 'shift';\n if (defaultIsShift) {\n shiftKey = !shiftKey;\n }\n if (shiftKey) {\n const otherCol = this.getDisplayedColAfter(col);\n if (!otherCol) {\n return;\n }\n const widthDiff = col.getActualWidth() - columnWidth.newWidth;\n const otherColWidth = otherCol.getActualWidth() + widthDiff;\n sets.push({\n width: otherColWidth,\n ratios: [1],\n columns: [otherCol]\n });\n }\n });\n if (sets.length === 0) {\n return;\n }\n this.resizeColumnSets({\n resizeSets: sets,\n finished,\n source\n });\n }\n checkMinAndMaxWidthsForSet(columnResizeSet) {\n const { columns, width } = columnResizeSet;\n // every col has a min width, so sum them all up and see if we have enough room\n // for all the min widths\n let minWidthAccumulated = 0;\n let maxWidthAccumulated = 0;\n let maxWidthActive = true;\n columns.forEach(col => {\n const minWidth = col.getMinWidth();\n minWidthAccumulated += minWidth || 0;\n const maxWidth = col.getMaxWidth();\n if (exists(maxWidth) && maxWidth > 0) {\n maxWidthAccumulated += maxWidth;\n }\n else {\n // if at least one columns has no max width, it means the group of columns\n // then has no max width, as at least one column can take as much width as possible\n maxWidthActive = false;\n }\n });\n const minWidthPasses = width >= minWidthAccumulated;\n const maxWidthPasses = !maxWidthActive || (width <= maxWidthAccumulated);\n return minWidthPasses && maxWidthPasses;\n }\n // method takes sets of columns and resizes them. either all sets will be resized, or nothing\n // be resized. this is used for example when user tries to resize a group and holds shift key,\n // then both the current group (grows), and the adjacent group (shrinks), will get resized,\n // so that's two sets for this method.\n resizeColumnSets(params) {\n const { resizeSets, finished, source } = params;\n const passMinMaxCheck = !resizeSets || resizeSets.every(columnResizeSet => this.checkMinAndMaxWidthsForSet(columnResizeSet));\n if (!passMinMaxCheck) {\n // even though we are not going to resize beyond min/max size, we still need to dispatch event when finished\n if (finished) {\n const columns = resizeSets && resizeSets.length > 0 ? resizeSets[0].columns : null;\n this.dispatchColumnResizedEvent(columns, finished, source);\n }\n return; // don't resize!\n }\n const changedCols = [];\n const allResizedCols = [];\n resizeSets.forEach(set => {\n const { width, columns, ratios } = set;\n // keep track of pixels used, and last column gets the remaining,\n // to cater for rounding errors, and min width adjustments\n const newWidths = {};\n const finishedCols = {};\n columns.forEach(col => allResizedCols.push(col));\n // the loop below goes through each col. if a col exceeds it's min/max width,\n // it then gets set to its min/max width and the column is removed marked as 'finished'\n // and the calculation is done again leaving this column out. take for example columns\n // {A, width: 50, maxWidth: 100}\n // {B, width: 50}\n // {C, width: 50}\n // and then the set is set to width 600 - on the first pass the grid tries to set each column\n // to 200. it checks A and sees 200 > 100 and so sets the width to 100. col A is then marked\n // as 'finished' and the calculation is done again with the remaining cols B and C, which end up\n // splitting the remaining 500 pixels.\n let finishedColsGrew = true;\n let loopCount = 0;\n while (finishedColsGrew) {\n loopCount++;\n if (loopCount > 1000) {\n // this should never happen, but in the future, someone might introduce a bug here,\n // so we stop the browser from hanging and report bug properly\n console.error('AG Grid: infinite loop in resizeColumnSets');\n break;\n }\n finishedColsGrew = false;\n const subsetCols = [];\n let subsetRatioTotal = 0;\n let pixelsToDistribute = width;\n columns.forEach((col, index) => {\n const thisColFinished = finishedCols[col.getId()];\n if (thisColFinished) {\n pixelsToDistribute -= newWidths[col.getId()];\n }\n else {\n subsetCols.push(col);\n const ratioThisCol = ratios[index];\n subsetRatioTotal += ratioThisCol;\n }\n });\n // because we are not using all of the ratios (cols can be missing),\n // we scale the ratio. if all columns are included, then subsetRatioTotal=1,\n // and so the ratioScale will be 1.\n const ratioScale = 1 / subsetRatioTotal;\n subsetCols.forEach((col, index) => {\n const lastCol = index === (subsetCols.length - 1);\n let colNewWidth;\n if (lastCol) {\n colNewWidth = pixelsToDistribute;\n }\n else {\n colNewWidth = Math.round(ratios[index] * width * ratioScale);\n pixelsToDistribute -= colNewWidth;\n }\n const minWidth = col.getMinWidth();\n const maxWidth = col.getMaxWidth();\n if (exists(minWidth) && colNewWidth < minWidth) {\n colNewWidth = minWidth;\n finishedCols[col.getId()] = true;\n finishedColsGrew = true;\n }\n else if (exists(maxWidth) && maxWidth > 0 && colNewWidth > maxWidth) {\n colNewWidth = maxWidth;\n finishedCols[col.getId()] = true;\n finishedColsGrew = true;\n }\n newWidths[col.getId()] = colNewWidth;\n });\n }\n columns.forEach(col => {\n const newWidth = newWidths[col.getId()];\n const actualWidth = col.getActualWidth();\n if (actualWidth !== newWidth) {\n col.setActualWidth(newWidth, source);\n changedCols.push(col);\n }\n });\n });\n // if no cols changed, then no need to update more or send event.\n const atLeastOneColChanged = changedCols.length > 0;\n let flexedCols = [];\n if (atLeastOneColChanged) {\n flexedCols = this.refreshFlexedColumns({ resizingCols: allResizedCols, skipSetLeft: true });\n this.setLeftValues(source);\n this.updateBodyWidths();\n this.checkViewportColumns();\n }\n // check for change first, to avoid unnecessary firing of events\n // however we always dispatch 'finished' events. this is important\n // when groups are resized, as if the group is changing slowly,\n // eg 1 pixel at a time, then each change will dispatch change events\n // in all the columns in the group, but only one with get the pixel.\n const colsForEvent = allResizedCols.concat(flexedCols);\n if (atLeastOneColChanged || finished) {\n this.dispatchColumnResizedEvent(colsForEvent, finished, source, flexedCols);\n }\n }\n setColumnAggFunc(key, aggFunc, source = \"api\") {\n if (!key) {\n return;\n }\n const column = this.getPrimaryColumn(key);\n if (!column) {\n return;\n }\n column.setAggFunc(aggFunc);\n this.dispatchColumnChangedEvent(Events.EVENT_COLUMN_VALUE_CHANGED, [column], source);\n }\n moveRowGroupColumn(fromIndex, toIndex, source = \"api\") {\n const column = this.rowGroupColumns[fromIndex];\n const impactedColumns = this.rowGroupColumns.slice(fromIndex, toIndex);\n this.rowGroupColumns.splice(fromIndex, 1);\n this.rowGroupColumns.splice(toIndex, 0, column);\n const event = {\n type: Events.EVENT_COLUMN_ROW_GROUP_CHANGED,\n columns: impactedColumns,\n column: impactedColumns.length === 1 ? impactedColumns[0] : null,\n source: source\n };\n this.eventService.dispatchEvent(event);\n }\n moveColumns(columnsToMoveKeys, toIndex, source = \"api\", finished = true) {\n this.columnAnimationService.start();\n if (toIndex > this.gridColumns.length - columnsToMoveKeys.length) {\n console.warn('AG Grid: tried to insert columns in invalid location, toIndex = ' + toIndex);\n console.warn('AG Grid: remember that you should not count the moving columns when calculating the new index');\n return;\n }\n // we want to pull all the columns out first and put them into an ordered list\n const movedColumns = this.getGridColumns(columnsToMoveKeys);\n const failedRules = !this.doesMovePassRules(movedColumns, toIndex);\n if (failedRules) {\n return;\n }\n moveInArray(this.gridColumns, movedColumns, toIndex);\n this.updateDisplayedColumns(source);\n this.dispatchColumnMovedEvent({ movedColumns, source, toIndex, finished });\n this.columnAnimationService.finish();\n }\n doesMovePassRules(columnsToMove, toIndex) {\n // make a copy of what the grid columns would look like after the move\n const proposedColumnOrder = this.getProposedColumnOrder(columnsToMove, toIndex);\n return this.doesOrderPassRules(proposedColumnOrder);\n }\n doesOrderPassRules(gridOrder) {\n if (!this.doesMovePassMarryChildren(gridOrder)) {\n return false;\n }\n if (!this.doesMovePassLockedPositions(gridOrder)) {\n return false;\n }\n return true;\n }\n getProposedColumnOrder(columnsToMove, toIndex) {\n const proposedColumnOrder = this.gridColumns.slice();\n moveInArray(proposedColumnOrder, columnsToMove, toIndex);\n return proposedColumnOrder;\n }\n // returns the provided cols sorted in same order as they appear in grid columns. eg if grid columns\n // contains [a,b,c,d,e] and col passed is [e,a] then the passed cols are sorted into [a,e]\n sortColumnsLikeGridColumns(cols) {\n if (!cols || cols.length <= 1) {\n return;\n }\n const notAllColsInGridColumns = cols.filter(c => this.gridColumns.indexOf(c) < 0).length > 0;\n if (notAllColsInGridColumns) {\n return;\n }\n cols.sort((a, b) => {\n const indexA = this.gridColumns.indexOf(a);\n const indexB = this.gridColumns.indexOf(b);\n return indexA - indexB;\n });\n }\n doesMovePassLockedPositions(proposedColumnOrder) {\n // Placement is a number indicating 'left' 'center' or 'right' as 0 1 2\n let lastPlacement = 0;\n let rulePassed = true;\n const lockPositionToPlacement = (position) => {\n if (!position) { // false or undefined\n return 1;\n }\n if (position === true) {\n return 0;\n }\n return position === 'left' ? 0 : 2; // Otherwise 'right'\n };\n proposedColumnOrder.forEach(col => {\n const placement = lockPositionToPlacement(col.getColDef().lockPosition);\n if (placement < lastPlacement) { // If placement goes down, we're not in the correct order\n rulePassed = false;\n }\n lastPlacement = placement;\n });\n return rulePassed;\n }\n doesMovePassMarryChildren(allColumnsCopy) {\n let rulePassed = true;\n this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, child => {\n if (!(child instanceof ProvidedColumnGroup)) {\n return;\n }\n const columnGroup = child;\n const colGroupDef = columnGroup.getColGroupDef();\n const marryChildren = colGroupDef && colGroupDef.marryChildren;\n if (!marryChildren) {\n return;\n }\n const newIndexes = [];\n columnGroup.getLeafColumns().forEach(col => {\n const newColIndex = allColumnsCopy.indexOf(col);\n newIndexes.push(newColIndex);\n });\n const maxIndex = Math.max.apply(Math, newIndexes);\n const minIndex = Math.min.apply(Math, newIndexes);\n // spread is how far the first column in this group is away from the last column\n const spread = maxIndex - minIndex;\n const maxSpread = columnGroup.getLeafColumns().length - 1;\n // if the columns\n if (spread > maxSpread) {\n rulePassed = false;\n }\n // console.log(`maxIndex = ${maxIndex}, minIndex = ${minIndex}, spread = ${spread}, maxSpread = ${maxSpread}, fail = ${spread > (count-1)}`)\n // console.log(allColumnsCopy.map( col => col.getColDef().field).join(','));\n });\n return rulePassed;\n }\n moveColumn(key, toIndex, source = \"api\") {\n this.moveColumns([key], toIndex, source);\n }\n moveColumnByIndex(fromIndex, toIndex, source = \"api\") {\n const column = this.gridColumns[fromIndex];\n this.moveColumn(column, toIndex, source);\n }\n getColumnDefs() {\n if (!this.primaryColumns) {\n return;\n }\n const cols = this.primaryColumns.slice();\n if (this.gridColsArePrimary) {\n cols.sort((a, b) => this.gridColumns.indexOf(a) - this.gridColumns.indexOf(b));\n }\n else if (this.lastPrimaryOrder) {\n cols.sort((a, b) => this.lastPrimaryOrder.indexOf(a) - this.lastPrimaryOrder.indexOf(b));\n }\n return this.columnDefFactory.buildColumnDefs(cols, this.rowGroupColumns, this.pivotColumns);\n }\n // used by:\n // + angularGrid -> for setting body width\n // + rowController -> setting main row widths (when inserting and resizing)\n // need to cache this\n getBodyContainerWidth() {\n return this.bodyWidth;\n }\n getContainerWidth(pinned) {\n switch (pinned) {\n case 'left':\n return this.leftWidth;\n case 'right':\n return this.rightWidth;\n default:\n return this.bodyWidth;\n }\n }\n // after setColumnWidth or updateGroupsAndDisplayedColumns\n updateBodyWidths() {\n const newBodyWidth = this.getWidthOfColsInList(this.displayedColumnsCenter);\n const newLeftWidth = this.getWidthOfColsInList(this.displayedColumnsLeft);\n const newRightWidth = this.getWidthOfColsInList(this.displayedColumnsRight);\n // this is used by virtual col calculation, for RTL only, as a change to body width can impact displayed\n // columns, due to RTL inverting the y coordinates\n this.bodyWidthDirty = this.bodyWidth !== newBodyWidth;\n const atLeastOneChanged = this.bodyWidth !== newBodyWidth || this.leftWidth !== newLeftWidth || this.rightWidth !== newRightWidth;\n if (atLeastOneChanged) {\n this.bodyWidth = newBodyWidth;\n this.leftWidth = newLeftWidth;\n this.rightWidth = newRightWidth;\n // when this fires, it is picked up by the gridPanel, which ends up in\n // gridPanel calling setWidthAndScrollPosition(), which in turn calls setViewportPosition()\n const event = {\n type: Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED,\n };\n this.eventService.dispatchEvent(event);\n }\n }\n // + rowController\n getValueColumns() {\n return this.valueColumns ? this.valueColumns : [];\n }\n // + rowController\n getPivotColumns() {\n return this.pivotColumns ? this.pivotColumns : [];\n }\n // + clientSideRowModel\n isPivotActive() {\n return this.pivotColumns && this.pivotColumns.length > 0 && this.pivotMode;\n }\n // + toolPanel\n getRowGroupColumns() {\n return this.rowGroupColumns ? this.rowGroupColumns : [];\n }\n // + rowController -> while inserting rows\n getDisplayedCenterColumns() {\n return this.displayedColumnsCenter;\n }\n // + rowController -> while inserting rows\n getDisplayedLeftColumns() {\n return this.displayedColumnsLeft;\n }\n getDisplayedRightColumns() {\n return this.displayedColumnsRight;\n }\n getDisplayedColumns(type) {\n switch (type) {\n case 'left':\n return this.getDisplayedLeftColumns();\n case 'right':\n return this.getDisplayedRightColumns();\n default:\n return this.getDisplayedCenterColumns();\n }\n }\n // used by:\n // + clientSideRowController -> sorting, building quick filter text\n // + headerRenderer -> sorting (clearing icon)\n getAllPrimaryColumns() {\n return this.primaryColumns ? this.primaryColumns.slice() : null;\n }\n getSecondaryColumns() {\n return this.secondaryColumns ? this.secondaryColumns.slice() : null;\n }\n getAllColumnsForQuickFilter() {\n return this.columnsForQuickFilter;\n }\n // + moveColumnController\n getAllGridColumns() {\n return this.gridColumns;\n }\n isEmpty() {\n return missingOrEmpty(this.gridColumns);\n }\n isRowGroupEmpty() {\n return missingOrEmpty(this.rowGroupColumns);\n }\n setColumnVisible(key, visible, source = \"api\") {\n this.setColumnsVisible([key], visible, source);\n }\n setColumnsVisible(keys, visible = false, source = \"api\") {\n this.applyColumnState({\n state: keys.map(key => ({\n colId: typeof key === 'string' ? key : key.getColId(),\n hide: !visible,\n })),\n }, source);\n }\n setColumnPinned(key, pinned, source = \"api\") {\n if (key) {\n this.setColumnsPinned([key], pinned, source);\n }\n }\n setColumnsPinned(keys, pinned, source = \"api\") {\n if (this.gridOptionsService.isDomLayout('print')) {\n console.warn(`AG Grid: Changing the column pinning status is not allowed with domLayout='print'`);\n return;\n }\n this.columnAnimationService.start();\n let actualPinned;\n if (pinned === true || pinned === 'left') {\n actualPinned = 'left';\n }\n else if (pinned === 'right') {\n actualPinned = 'right';\n }\n else {\n actualPinned = null;\n }\n this.actionOnGridColumns(keys, (col) => {\n if (col.getPinned() !== actualPinned) {\n col.setPinned(actualPinned);\n return true;\n }\n return false;\n }, source, () => {\n const event = {\n type: Events.EVENT_COLUMN_PINNED,\n pinned: actualPinned,\n column: null,\n columns: null,\n source: source\n };\n return event;\n });\n this.columnAnimationService.finish();\n }\n // does an action on a set of columns. provides common functionality for looking up the\n // columns based on key, getting a list of effected columns, and then updated the event\n // with either one column (if it was just one col) or a list of columns\n // used by: autoResize, setVisible, setPinned\n actionOnGridColumns(// the column keys this action will be on\n keys, \n // the action to do - if this returns false, the column was skipped\n // and won't be included in the event\n action, \n // should return back a column event of the right type\n source, createEvent) {\n if (missingOrEmpty(keys)) {\n return;\n }\n const updatedColumns = [];\n keys.forEach((key) => {\n const column = this.getGridColumn(key);\n if (!column) {\n return;\n }\n // need to check for false with type (ie !== instead of !=)\n // as not returning anything (undefined) would also be false\n const resultOfAction = action(column);\n if (resultOfAction !== false) {\n updatedColumns.push(column);\n }\n });\n if (!updatedColumns.length) {\n return;\n }\n this.updateDisplayedColumns(source);\n if (exists(createEvent) && createEvent) {\n const event = createEvent();\n event.columns = updatedColumns;\n event.column = updatedColumns.length === 1 ? updatedColumns[0] : null;\n this.eventService.dispatchEvent(event);\n }\n }\n getDisplayedColBefore(col) {\n const allDisplayedColumns = this.getAllDisplayedColumns();\n const oldIndex = allDisplayedColumns.indexOf(col);\n if (oldIndex > 0) {\n return allDisplayedColumns[oldIndex - 1];\n }\n return null;\n }\n // used by:\n // + rowRenderer -> for navigation\n getDisplayedColAfter(col) {\n const allDisplayedColumns = this.getAllDisplayedColumns();\n const oldIndex = allDisplayedColumns.indexOf(col);\n if (oldIndex < (allDisplayedColumns.length - 1)) {\n return allDisplayedColumns[oldIndex + 1];\n }\n return null;\n }\n getDisplayedGroupAfter(columnGroup) {\n return this.getDisplayedGroupAtDirection(columnGroup, 'After');\n }\n getDisplayedGroupBefore(columnGroup) {\n return this.getDisplayedGroupAtDirection(columnGroup, 'Before');\n }\n getDisplayedGroupAtDirection(columnGroup, direction) {\n // pick the last displayed column in this group\n const requiredLevel = columnGroup.getProvidedColumnGroup().getLevel() + columnGroup.getPaddingLevel();\n const colGroupLeafColumns = columnGroup.getDisplayedLeafColumns();\n const col = direction === 'After' ? last(colGroupLeafColumns) : colGroupLeafColumns[0];\n const getDisplayColMethod = `getDisplayedCol${direction}`;\n while (true) {\n // keep moving to the next col, until we get to another group\n const column = this[getDisplayColMethod](col);\n if (!column) {\n return null;\n }\n const groupPointer = this.getColumnGroupAtLevel(column, requiredLevel);\n if (groupPointer !== columnGroup) {\n return groupPointer;\n }\n }\n }\n getColumnGroupAtLevel(column, level) {\n // get group at same level as the one we are looking for\n let groupPointer = column.getParent();\n let originalGroupLevel;\n let groupPointerLevel;\n while (true) {\n const groupPointerProvidedColumnGroup = groupPointer.getProvidedColumnGroup();\n originalGroupLevel = groupPointerProvidedColumnGroup.getLevel();\n groupPointerLevel = groupPointer.getPaddingLevel();\n if (originalGroupLevel + groupPointerLevel <= level) {\n break;\n }\n groupPointer = groupPointer.getParent();\n }\n return groupPointer;\n }\n isPinningLeft() {\n return this.displayedColumnsLeft.length > 0;\n }\n isPinningRight() {\n return this.displayedColumnsRight.length > 0;\n }\n getPrimaryAndSecondaryAndAutoColumns() {\n return [].concat(...[\n this.primaryColumns || [],\n this.groupAutoColumns || [],\n this.secondaryColumns || [],\n ]);\n }\n createStateItemFromColumn(column) {\n const rowGroupIndex = column.isRowGroupActive() ? this.rowGroupColumns.indexOf(column) : null;\n const pivotIndex = column.isPivotActive() ? this.pivotColumns.indexOf(column) : null;\n const aggFunc = column.isValueActive() ? column.getAggFunc() : null;\n const sort = column.getSort() != null ? column.getSort() : null;\n const sortIndex = column.getSortIndex() != null ? column.getSortIndex() : null;\n const flex = column.getFlex() != null && column.getFlex() > 0 ? column.getFlex() : null;\n const res = {\n colId: column.getColId(),\n width: column.getActualWidth(),\n hide: !column.isVisible(),\n pinned: column.getPinned(),\n sort,\n sortIndex,\n aggFunc,\n rowGroup: column.isRowGroupActive(),\n rowGroupIndex,\n pivot: column.isPivotActive(),\n pivotIndex: pivotIndex,\n flex\n };\n return res;\n }\n getColumnState() {\n if (missing(this.primaryColumns) || !this.isAlive()) {\n return [];\n }\n const colsForState = this.getPrimaryAndSecondaryAndAutoColumns();\n const res = colsForState.map(this.createStateItemFromColumn.bind(this));\n this.orderColumnStateList(res);\n return res;\n }\n orderColumnStateList(columnStateList) {\n // for fast looking, store the index of each column\n const colIdToGridIndexMap = convertToMap(this.gridColumns.map((col, index) => [col.getColId(), index]));\n columnStateList.sort((itemA, itemB) => {\n const posA = colIdToGridIndexMap.has(itemA.colId) ? colIdToGridIndexMap.get(itemA.colId) : -1;\n const posB = colIdToGridIndexMap.has(itemB.colId) ? colIdToGridIndexMap.get(itemB.colId) : -1;\n return posA - posB;\n });\n }\n resetColumnState(source = \"api\") {\n // NOTE = there is one bug here that no customer has noticed - if a column has colDef.lockPosition,\n // this is ignored below when ordering the cols. to work, we should always put lockPosition cols first.\n // As a work around, developers should just put lockPosition columns first in their colDef list.\n // we can't use 'allColumns' as the order might of messed up, so get the primary ordered list\n const primaryColumns = this.getColumnsFromTree(this.primaryColumnTree);\n const columnStates = [];\n // we start at 1000, so if user has mix of rowGroup and group specified, it will work with both.\n // eg IF user has ColA.rowGroupIndex=0, ColB.rowGroupIndex=1, ColC.rowGroup=true,\n // THEN result will be ColA.rowGroupIndex=0, ColB.rowGroupIndex=1, ColC.rowGroup=1000\n let letRowGroupIndex = 1000;\n let letPivotIndex = 1000;\n let colsToProcess = [];\n if (this.groupAutoColumns) {\n colsToProcess = colsToProcess.concat(this.groupAutoColumns);\n }\n if (primaryColumns) {\n colsToProcess = colsToProcess.concat(primaryColumns);\n }\n colsToProcess.forEach(column => {\n const stateItem = this.getColumnStateFromColDef(column);\n if (missing(stateItem.rowGroupIndex) && stateItem.rowGroup) {\n stateItem.rowGroupIndex = letRowGroupIndex++;\n }\n if (missing(stateItem.pivotIndex) && stateItem.pivot) {\n stateItem.pivotIndex = letPivotIndex++;\n }\n columnStates.push(stateItem);\n });\n this.applyColumnState({ state: columnStates, applyOrder: true }, source);\n }\n getColumnStateFromColDef(column) {\n const getValueOrNull = (a, b) => a != null ? a : b != null ? b : null;\n const colDef = column.getColDef();\n const sort = getValueOrNull(colDef.sort, colDef.initialSort);\n const sortIndex = getValueOrNull(colDef.sortIndex, colDef.initialSortIndex);\n const hide = getValueOrNull(colDef.hide, colDef.initialHide);\n const pinned = getValueOrNull(colDef.pinned, colDef.initialPinned);\n const width = getValueOrNull(colDef.width, colDef.initialWidth);\n const flex = getValueOrNull(colDef.flex, colDef.initialFlex);\n let rowGroupIndex = getValueOrNull(colDef.rowGroupIndex, colDef.initialRowGroupIndex);\n let rowGroup = getValueOrNull(colDef.rowGroup, colDef.initialRowGroup);\n if (rowGroupIndex == null && (rowGroup == null || rowGroup == false)) {\n rowGroupIndex = null;\n rowGroup = null;\n }\n let pivotIndex = getValueOrNull(colDef.pivotIndex, colDef.initialPivotIndex);\n let pivot = getValueOrNull(colDef.pivot, colDef.initialPivot);\n if (pivotIndex == null && (pivot == null || pivot == false)) {\n pivotIndex = null;\n pivot = null;\n }\n const aggFunc = getValueOrNull(colDef.aggFunc, colDef.initialAggFunc);\n return {\n colId: column.getColId(),\n sort,\n sortIndex,\n hide,\n pinned,\n width,\n flex,\n rowGroup,\n rowGroupIndex,\n pivot,\n pivotIndex,\n aggFunc,\n };\n }\n applyColumnState(params, source) {\n if (missingOrEmpty(this.primaryColumns)) {\n return false;\n }\n if (params && params.state && !params.state.forEach) {\n console.warn('AG Grid: applyColumnState() - the state attribute should be an array, however an array was not found. Please provide an array of items (one for each col you want to change) for state.');\n return false;\n }\n const applyStates = (states, existingColumns, getById) => {\n const dispatchEventsFunc = this.compareColumnStatesAndDispatchEvents(source);\n this.autoGroupsNeedBuilding = true;\n // at the end below, this list will have all columns we got no state for\n const columnsWithNoState = existingColumns.slice();\n const rowGroupIndexes = {};\n const pivotIndexes = {};\n const autoGroupColumnStates = [];\n // If pivoting is modified, these are the states we try to reapply after\n // the secondary columns are re-generated\n const unmatchedAndAutoStates = [];\n let unmatchedCount = 0;\n const previousRowGroupCols = this.rowGroupColumns.slice();\n const previousPivotCols = this.pivotColumns.slice();\n states.forEach((state) => {\n const colId = state.colId || '';\n // auto group columns are re-created so deferring syncing with ColumnState\n const isAutoGroupColumn = colId.startsWith(GROUP_AUTO_COLUMN_ID);\n if (isAutoGroupColumn) {\n autoGroupColumnStates.push(state);\n unmatchedAndAutoStates.push(state);\n return;\n }\n const column = getById(colId);\n if (!column) {\n unmatchedAndAutoStates.push(state);\n unmatchedCount += 1;\n }\n else {\n this.syncColumnWithStateItem(column, state, params.defaultState, rowGroupIndexes, pivotIndexes, false, source);\n removeFromArray(columnsWithNoState, column);\n }\n });\n // anything left over, we got no data for, so add in the column as non-value, non-rowGroup and hidden\n const applyDefaultsFunc = (col) => this.syncColumnWithStateItem(col, null, params.defaultState, rowGroupIndexes, pivotIndexes, false, source);\n columnsWithNoState.forEach(applyDefaultsFunc);\n // sort the lists according to the indexes that were provided\n const comparator = (indexes, oldList, colA, colB) => {\n const indexA = indexes[colA.getId()];\n const indexB = indexes[colB.getId()];\n const aHasIndex = indexA != null;\n const bHasIndex = indexB != null;\n if (aHasIndex && bHasIndex) {\n // both a and b are new cols with index, so sort on index\n return indexA - indexB;\n }\n if (aHasIndex) {\n // a has an index, so it should be before a\n return -1;\n }\n if (bHasIndex) {\n // b has an index, so it should be before a\n return 1;\n }\n const oldIndexA = oldList.indexOf(colA);\n const oldIndexB = oldList.indexOf(colB);\n const aHasOldIndex = oldIndexA >= 0;\n const bHasOldIndex = oldIndexB >= 0;\n if (aHasOldIndex && bHasOldIndex) {\n // both a and b are old cols, so sort based on last order\n return oldIndexA - oldIndexB;\n }\n if (aHasOldIndex) {\n // a is old, b is new, so b is first\n return -1;\n }\n // this bit does matter, means both are new cols\n // but without index or that b is old and a is new\n return 1;\n };\n this.rowGroupColumns.sort(comparator.bind(this, rowGroupIndexes, previousRowGroupCols));\n this.pivotColumns.sort(comparator.bind(this, pivotIndexes, previousPivotCols));\n this.updateGridColumns();\n // sync newly created auto group columns with ColumnState\n const autoGroupColsCopy = this.groupAutoColumns ? this.groupAutoColumns.slice() : [];\n autoGroupColumnStates.forEach(stateItem => {\n const autoCol = this.getAutoColumn(stateItem.colId);\n removeFromArray(autoGroupColsCopy, autoCol);\n this.syncColumnWithStateItem(autoCol, stateItem, params.defaultState, null, null, true, source);\n });\n // autogroup cols with nothing else, apply the default\n autoGroupColsCopy.forEach(applyDefaultsFunc);\n this.applyOrderAfterApplyState(params);\n this.updateDisplayedColumns(source);\n this.dispatchEverythingChanged(source);\n dispatchEventsFunc(); // Will trigger secondary column changes if pivoting modified\n return { unmatchedAndAutoStates, unmatchedCount };\n };\n this.columnAnimationService.start();\n let { unmatchedAndAutoStates, unmatchedCount, } = applyStates(params.state || [], this.primaryColumns || [], (id) => this.getPrimaryColumn(id));\n // If there are still states left over, see if we can apply them to newly generated\n // secondary or auto columns. Also if defaults exist, ensure they are applied to secondary cols\n if (unmatchedAndAutoStates.length > 0 || exists(params.defaultState)) {\n unmatchedCount = applyStates(unmatchedAndAutoStates, this.secondaryColumns || [], (id) => this.getSecondaryColumn(id)).unmatchedCount;\n }\n this.columnAnimationService.finish();\n return unmatchedCount === 0; // Successful if no states unaccounted for\n }\n applyOrderAfterApplyState(params) {\n if (!params.applyOrder || !params.state) {\n return;\n }\n let newOrder = [];\n const processedColIds = {};\n params.state.forEach(item => {\n if (!item.colId || processedColIds[item.colId]) {\n return;\n }\n const col = this.gridColumnsMap[item.colId];\n if (col) {\n newOrder.push(col);\n processedColIds[item.colId] = true;\n }\n });\n // add in all other columns\n let autoGroupInsertIndex = 0;\n this.gridColumns.forEach(col => {\n const colId = col.getColId();\n const alreadyProcessed = processedColIds[colId] != null;\n if (alreadyProcessed) {\n return;\n }\n const isAutoGroupCol = colId.startsWith(GROUP_AUTO_COLUMN_ID);\n if (isAutoGroupCol) {\n // auto group columns, if missing from state list, are added to the start.\n // it's common to have autoGroup missing, as grouping could be on by default\n // on a column, but the user could of since removed the grouping via the UI.\n // if we don't inc the insert index, autoGroups will be inserted in reverse order\n insertIntoArray(newOrder, col, autoGroupInsertIndex++);\n }\n else {\n // normal columns, if missing from state list, are added at the end\n newOrder.push(col);\n }\n });\n // this is already done in updateGridColumns, however we changed the order above (to match the order of the state\n // columns) so we need to do it again. we could of put logic into the order above to take into account fixed\n // columns, however if we did then we would have logic for updating fixed columns twice. reusing the logic here\n // is less sexy for the code here, but it keeps consistency.\n newOrder = this.placeLockedColumns(newOrder);\n if (!this.doesMovePassMarryChildren(newOrder)) {\n console.warn('AG Grid: Applying column order broke a group where columns should be married together. Applying new order has been discarded.');\n return;\n }\n this.gridColumns = newOrder;\n }\n compareColumnStatesAndDispatchEvents(source) {\n const startState = {\n rowGroupColumns: this.rowGroupColumns.slice(),\n pivotColumns: this.pivotColumns.slice(),\n valueColumns: this.valueColumns.slice()\n };\n const columnStateBefore = this.getColumnState();\n const columnStateBeforeMap = {};\n columnStateBefore.forEach(col => {\n columnStateBeforeMap[col.colId] = col;\n });\n return () => {\n const colsForState = this.getPrimaryAndSecondaryAndAutoColumns();\n // dispatches generic ColumnEvents where all columns are returned rather than what has changed\n const dispatchWhenListsDifferent = (eventType, colsBefore, colsAfter, idMapper) => {\n const beforeList = colsBefore.map(idMapper);\n const afterList = colsAfter.map(idMapper);\n const unchanged = areEqual(beforeList, afterList);\n if (unchanged) {\n return;\n }\n const changes = new Set(colsBefore);\n colsAfter.forEach(id => {\n // if the first list had it, delete it, as it's unchanged.\n if (!changes.delete(id)) {\n // if the second list has it, and first doesn't, add it.\n changes.add(id);\n }\n });\n const changesArr = [...changes];\n const event = {\n type: eventType,\n columns: changesArr,\n column: changesArr.length === 1 ? changesArr[0] : null,\n source: source\n };\n this.eventService.dispatchEvent(event);\n };\n // determines which columns have changed according to supplied predicate\n const getChangedColumns = (changedPredicate) => {\n const changedColumns = [];\n colsForState.forEach(column => {\n const colStateBefore = columnStateBeforeMap[column.getColId()];\n if (colStateBefore && changedPredicate(colStateBefore, column)) {\n changedColumns.push(column);\n }\n });\n return changedColumns;\n };\n const columnIdMapper = (c) => c.getColId();\n dispatchWhenListsDifferent(Events.EVENT_COLUMN_ROW_GROUP_CHANGED, startState.rowGroupColumns, this.rowGroupColumns, columnIdMapper);\n dispatchWhenListsDifferent(Events.EVENT_COLUMN_PIVOT_CHANGED, startState.pivotColumns, this.pivotColumns, columnIdMapper);\n const valueChangePredicate = (cs, c) => {\n const oldActive = cs.aggFunc != null;\n const activeChanged = oldActive != c.isValueActive();\n // we only check aggFunc if the agg is active\n const aggFuncChanged = oldActive && cs.aggFunc != c.getAggFunc();\n return activeChanged || aggFuncChanged;\n };\n const changedValues = getChangedColumns(valueChangePredicate);\n if (changedValues.length > 0) {\n this.dispatchColumnChangedEvent(Events.EVENT_COLUMN_VALUE_CHANGED, changedValues, source);\n }\n const resizeChangePredicate = (cs, c) => cs.width != c.getActualWidth();\n this.dispatchColumnResizedEvent(getChangedColumns(resizeChangePredicate), true, source);\n const pinnedChangePredicate = (cs, c) => cs.pinned != c.getPinned();\n this.dispatchColumnPinnedEvent(getChangedColumns(pinnedChangePredicate), source);\n const visibilityChangePredicate = (cs, c) => cs.hide == c.isVisible();\n this.dispatchColumnVisibleEvent(getChangedColumns(visibilityChangePredicate), source);\n const sortChangePredicate = (cs, c) => cs.sort != c.getSort() || cs.sortIndex != c.getSortIndex();\n if (getChangedColumns(sortChangePredicate).length > 0) {\n this.sortController.dispatchSortChangedEvents(source);\n }\n // special handling for moved column events\n this.normaliseColumnMovedEventForColumnState(columnStateBefore, source);\n };\n }\n getCommonValue(cols, valueGetter) {\n if (!cols || cols.length == 0) {\n return undefined;\n }\n // compare each value to the first value. if nothing differs, then value is common so return it.\n const firstValue = valueGetter(cols[0]);\n for (let i = 1; i < cols.length; i++) {\n if (firstValue !== valueGetter(cols[i])) {\n // values differ, no common value\n return undefined;\n }\n }\n return firstValue;\n }\n normaliseColumnMovedEventForColumnState(colStateBefore, source) {\n // we are only interested in columns that were both present and visible before and after\n const colStateAfter = this.getColumnState();\n const colStateAfterMapped = {};\n colStateAfter.forEach(s => colStateAfterMapped[s.colId] = s);\n // get id's of cols in both before and after lists\n const colsIntersectIds = {};\n colStateBefore.forEach(s => {\n if (colStateAfterMapped[s.colId]) {\n colsIntersectIds[s.colId] = true;\n }\n });\n // filter state lists, so we only have cols that were present before and after\n const beforeFiltered = colStateBefore.filter(c => colsIntersectIds[c.colId]);\n const afterFiltered = colStateAfter.filter(c => colsIntersectIds[c.colId]);\n // see if any cols are in a different location\n const movedColumns = [];\n afterFiltered.forEach((csAfter, index) => {\n const csBefore = beforeFiltered && beforeFiltered[index];\n if (csBefore && csBefore.colId !== csAfter.colId) {\n const gridCol = this.getGridColumn(csBefore.colId);\n if (gridCol) {\n movedColumns.push(gridCol);\n }\n }\n });\n if (!movedColumns.length) {\n return;\n }\n this.dispatchColumnMovedEvent({ movedColumns, source, finished: true });\n }\n syncColumnWithStateItem(column, stateItem, defaultState, rowGroupIndexes, pivotIndexes, autoCol, source) {\n if (!column) {\n return;\n }\n const getValue = (key1, key2) => {\n const obj = { value1: undefined, value2: undefined };\n let calculated = false;\n if (stateItem) {\n if (stateItem[key1] !== undefined) {\n obj.value1 = stateItem[key1];\n calculated = true;\n }\n if (exists(key2) && stateItem[key2] !== undefined) {\n obj.value2 = stateItem[key2];\n calculated = true;\n }\n }\n if (!calculated && defaultState) {\n if (defaultState[key1] !== undefined) {\n obj.value1 = defaultState[key1];\n }\n if (exists(key2) && defaultState[key2] !== undefined) {\n obj.value2 = defaultState[key2];\n }\n }\n return obj;\n };\n // following ensures we are left with boolean true or false, eg converts (null, undefined, 0) all to true\n const hide = getValue('hide').value1;\n if (hide !== undefined) {\n column.setVisible(!hide, source);\n }\n // sets pinned to 'left' or 'right'\n const pinned = getValue('pinned').value1;\n if (pinned !== undefined) {\n column.setPinned(pinned);\n }\n // if width provided and valid, use it, otherwise stick with the old width\n const minColWidth = this.columnUtils.calculateColMinWidth(column.getColDef());\n // flex\n const flex = getValue('flex').value1;\n if (flex !== undefined) {\n column.setFlex(flex);\n }\n // width - we only set width if column is not flexing\n const noFlexThisCol = column.getFlex() <= 0;\n if (noFlexThisCol) {\n // both null and undefined means we skip, as it's not possible to 'clear' width (a column must have a width)\n const width = getValue('width').value1;\n if (width != null) {\n if (minColWidth != null && width >= minColWidth) {\n column.setActualWidth(width, source);\n }\n }\n }\n const sort = getValue('sort').value1;\n if (sort !== undefined) {\n if (sort === 'desc' || sort === 'asc') {\n column.setSort(sort, source);\n }\n else {\n column.setSort(undefined, source);\n }\n }\n const sortIndex = getValue('sortIndex').value1;\n if (sortIndex !== undefined) {\n column.setSortIndex(sortIndex);\n }\n // we do not do aggFunc, rowGroup or pivot for auto cols or secondary cols\n if (autoCol || !column.isPrimary()) {\n return;\n }\n const aggFunc = getValue('aggFunc').value1;\n if (aggFunc !== undefined) {\n if (typeof aggFunc === 'string') {\n column.setAggFunc(aggFunc);\n if (!column.isValueActive()) {\n column.setValueActive(true, source);\n this.valueColumns.push(column);\n }\n }\n else {\n if (exists(aggFunc)) {\n console.warn('AG Grid: stateItem.aggFunc must be a string. if using your own aggregation ' +\n 'functions, register the functions first before using them in get/set state. This is because it is ' +\n 'intended for the column state to be stored and retrieved as simple JSON.');\n }\n // Note: we do not call column.setAggFunc(null), so that next time we aggregate\n // by this column (eg drag the column to the agg section int he toolpanel) it will\n // default to the last aggregation function.\n if (column.isValueActive()) {\n column.setValueActive(false, source);\n removeFromArray(this.valueColumns, column);\n }\n }\n }\n const { value1: rowGroup, value2: rowGroupIndex } = getValue('rowGroup', 'rowGroupIndex');\n if (rowGroup !== undefined || rowGroupIndex !== undefined) {\n if (typeof rowGroupIndex === 'number' || rowGroup) {\n if (!column.isRowGroupActive()) {\n column.setRowGroupActive(true, source);\n this.rowGroupColumns.push(column);\n }\n if (rowGroupIndexes && typeof rowGroupIndex === 'number') {\n rowGroupIndexes[column.getId()] = rowGroupIndex;\n }\n }\n else {\n if (column.isRowGroupActive()) {\n column.setRowGroupActive(false, source);\n removeFromArray(this.rowGroupColumns, column);\n }\n }\n }\n const { value1: pivot, value2: pivotIndex } = getValue('pivot', 'pivotIndex');\n if (pivot !== undefined || pivotIndex !== undefined) {\n if (typeof pivotIndex === 'number' || pivot) {\n if (!column.isPivotActive()) {\n column.setPivotActive(true, source);\n this.pivotColumns.push(column);\n }\n if (pivotIndexes && typeof pivotIndex === 'number') {\n pivotIndexes[column.getId()] = pivotIndex;\n }\n }\n else {\n if (column.isPivotActive()) {\n column.setPivotActive(false, source);\n removeFromArray(this.pivotColumns, column);\n }\n }\n }\n }\n getGridColumns(keys) {\n return this.getColumns(keys, this.getGridColumn.bind(this));\n }\n getColumns(keys, columnLookupCallback) {\n const foundColumns = [];\n if (keys) {\n keys.forEach((key) => {\n const column = columnLookupCallback(key);\n if (column) {\n foundColumns.push(column);\n }\n });\n }\n return foundColumns;\n }\n // used by growGroupPanel\n getColumnWithValidation(key) {\n if (key == null) {\n return null;\n }\n const column = this.getGridColumn(key);\n if (!column) {\n console.warn('AG Grid: could not find column ' + key);\n }\n return column;\n }\n getPrimaryColumn(key) {\n if (!this.primaryColumns) {\n return null;\n }\n return this.getColumn(key, this.primaryColumns, this.primaryColumnsMap);\n }\n getGridColumn(key) {\n return this.getColumn(key, this.gridColumns, this.gridColumnsMap);\n }\n getSecondaryColumn(key) {\n if (!this.secondaryColumns) {\n return null;\n }\n return this.getColumn(key, this.secondaryColumns, this.secondaryColumnsMap);\n }\n getColumn(key, columnList, columnMap) {\n if (!key) {\n return null;\n }\n // most of the time this method gets called the key is a string, so we put this shortcut in\n // for performance reasons, to see if we can match for ID (it doesn't do auto columns, that's done below)\n if (typeof key == 'string' && columnMap[key]) {\n return columnMap[key];\n }\n for (let i = 0; i < columnList.length; i++) {\n if (this.columnsMatch(columnList[i], key)) {\n return columnList[i];\n }\n }\n return this.getAutoColumn(key);\n }\n getSourceColumnsForGroupColumn(groupCol) {\n const sourceColumnId = groupCol.getColDef().showRowGroup;\n if (!sourceColumnId) {\n return null;\n }\n if (sourceColumnId === true) {\n return this.rowGroupColumns.slice(0);\n }\n const column = this.getPrimaryColumn(sourceColumnId);\n return column ? [column] : null;\n }\n getAutoColumn(key) {\n if (!this.groupAutoColumns ||\n !exists(this.groupAutoColumns) ||\n missing(this.groupAutoColumns)) {\n return null;\n }\n return this.groupAutoColumns.find(groupCol => this.columnsMatch(groupCol, key)) || null;\n }\n columnsMatch(column, key) {\n const columnMatches = column === key;\n const colDefMatches = column.getColDef() === key;\n const idMatches = column.getColId() == key;\n return columnMatches || colDefMatches || idMatches;\n }\n getDisplayNameForColumn(column, location, includeAggFunc = false) {\n if (!column) {\n return null;\n }\n const headerName = this.getHeaderName(column.getColDef(), column, null, null, location);\n if (includeAggFunc) {\n return this.wrapHeaderNameWithAggFunc(column, headerName);\n }\n return headerName;\n }\n getDisplayNameForProvidedColumnGroup(columnGroup, providedColumnGroup, location) {\n const colGroupDef = providedColumnGroup ? providedColumnGroup.getColGroupDef() : null;\n if (colGroupDef) {\n return this.getHeaderName(colGroupDef, null, columnGroup, providedColumnGroup, location);\n }\n return null;\n }\n getDisplayNameForColumnGroup(columnGroup, location) {\n return this.getDisplayNameForProvidedColumnGroup(columnGroup, columnGroup.getProvidedColumnGroup(), location);\n }\n // location is where the column is going to appear, ie who is calling us\n getHeaderName(colDef, column, columnGroup, providedColumnGroup, location) {\n const headerValueGetter = colDef.headerValueGetter;\n if (headerValueGetter) {\n const params = {\n colDef: colDef,\n column: column,\n columnGroup: columnGroup,\n providedColumnGroup: providedColumnGroup,\n location: location,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context\n };\n if (typeof headerValueGetter === 'function') {\n // valueGetter is a function, so just call it\n return headerValueGetter(params);\n }\n else if (typeof headerValueGetter === 'string') {\n // valueGetter is an expression, so execute the expression\n return this.expressionService.evaluate(headerValueGetter, params);\n }\n console.warn('AG Grid: headerValueGetter must be a function or a string');\n return '';\n }\n else if (colDef.headerName != null) {\n return colDef.headerName;\n }\n else if (colDef.field) {\n return camelCaseToHumanText(colDef.field);\n }\n return '';\n }\n wrapHeaderNameWithAggFunc(column, headerName) {\n if (this.gridOptionsService.is('suppressAggFuncInHeader')) {\n return headerName;\n }\n // only columns with aggregation active can have aggregations\n const pivotValueColumn = column.getColDef().pivotValueColumn;\n const pivotActiveOnThisColumn = exists(pivotValueColumn);\n let aggFunc = null;\n let aggFuncFound;\n // otherwise we have a measure that is active, and we are doing aggregation on it\n if (pivotActiveOnThisColumn) {\n const isCollapsedHeaderEnabled = this.gridOptionsService.is('removePivotHeaderRowWhenSingleValueColumn') && this.valueColumns.length === 1;\n const isTotalColumn = column.getColDef().pivotTotalColumnIds !== undefined;\n if (isCollapsedHeaderEnabled && !isTotalColumn) {\n return headerName; // Skip decorating the header - in this case the label is the pivot key, not the value col\n }\n aggFunc = pivotValueColumn ? pivotValueColumn.getAggFunc() : null;\n aggFuncFound = true;\n }\n else {\n const measureActive = column.isValueActive();\n const aggregationPresent = this.pivotMode || !this.isRowGroupEmpty();\n if (measureActive && aggregationPresent) {\n aggFunc = column.getAggFunc();\n aggFuncFound = true;\n }\n else {\n aggFuncFound = false;\n }\n }\n if (aggFuncFound) {\n const aggFuncString = (typeof aggFunc === 'string') ? aggFunc : 'func';\n const localeTextFunc = this.localeService.getLocaleTextFunc();\n const aggFuncStringTranslated = localeTextFunc(aggFuncString, aggFuncString);\n return `${aggFuncStringTranslated}(${headerName})`;\n }\n return headerName;\n }\n // returns the group with matching colId and instanceId. If instanceId is missing,\n // matches only on the colId.\n getColumnGroup(colId, partId) {\n if (!colId) {\n return null;\n }\n if (colId instanceof ColumnGroup) {\n return colId;\n }\n const allColumnGroups = this.getAllDisplayedTrees();\n const checkPartId = typeof partId === 'number';\n let result = null;\n this.columnUtils.depthFirstAllColumnTreeSearch(allColumnGroups, (child) => {\n if (child instanceof ColumnGroup) {\n const columnGroup = child;\n let matched;\n if (checkPartId) {\n matched = colId === columnGroup.getGroupId() && partId === columnGroup.getPartId();\n }\n else {\n matched = colId === columnGroup.getGroupId();\n }\n if (matched) {\n result = columnGroup;\n }\n }\n });\n return result;\n }\n isReady() {\n return this.ready;\n }\n extractValueColumns(source, oldPrimaryColumns) {\n this.valueColumns = this.extractColumns(oldPrimaryColumns, this.valueColumns, (col, flag) => col.setValueActive(flag, source), \n // aggFunc doesn't have index variant, cos order of value cols doesn't matter, so always return null\n () => undefined, () => undefined, \n // aggFunc is a string, so return it's existence\n (colDef) => {\n const aggFunc = colDef.aggFunc;\n // null or empty string means clear\n if (aggFunc === null || aggFunc === '') {\n return null;\n }\n if (aggFunc === undefined) {\n return;\n }\n return !!aggFunc;\n }, (colDef) => {\n // return false if any of the following: null, undefined, empty string\n return colDef.initialAggFunc != null && colDef.initialAggFunc != '';\n });\n // all new columns added will have aggFunc missing, so set it to what is in the colDef\n this.valueColumns.forEach(col => {\n const colDef = col.getColDef();\n // if aggFunc provided, we always override, as reactive property\n if (colDef.aggFunc != null && colDef.aggFunc != '') {\n col.setAggFunc(colDef.aggFunc);\n }\n else {\n // otherwise we use initialAggFunc only if no agg func set - which happens when new column only\n if (!col.getAggFunc()) {\n col.setAggFunc(colDef.initialAggFunc);\n }\n }\n });\n }\n extractRowGroupColumns(source, oldPrimaryColumns) {\n this.rowGroupColumns = this.extractColumns(oldPrimaryColumns, this.rowGroupColumns, (col, flag) => col.setRowGroupActive(flag, source), (colDef) => colDef.rowGroupIndex, (colDef) => colDef.initialRowGroupIndex, (colDef) => colDef.rowGroup, (colDef) => colDef.initialRowGroup);\n }\n extractColumns(oldPrimaryColumns = [], previousCols = [], setFlagFunc, getIndexFunc, getInitialIndexFunc, getValueFunc, getInitialValueFunc) {\n const colsWithIndex = [];\n const colsWithValue = [];\n // go though all cols.\n // if value, change\n // if default only, change only if new\n (this.primaryColumns || []).forEach(col => {\n const colIsNew = oldPrimaryColumns.indexOf(col) < 0;\n const colDef = col.getColDef();\n const value = attrToBoolean(getValueFunc(colDef));\n const initialValue = attrToBoolean(getInitialValueFunc(colDef));\n const index = attrToNumber(getIndexFunc(colDef));\n const initialIndex = attrToNumber(getInitialIndexFunc(colDef));\n let include;\n const valuePresent = value !== undefined;\n const indexPresent = index !== undefined;\n const initialValuePresent = initialValue !== undefined;\n const initialIndexPresent = initialIndex !== undefined;\n if (valuePresent) {\n include = value; // boolean value is guaranteed as attrToBoolean() is used above\n }\n else if (indexPresent) {\n if (index === null) {\n // if col is new we don't want to use the default / initial if index is set to null. Similarly,\n // we don't want to include the property for existing columns, i.e. we want to 'clear' it.\n include = false;\n }\n else {\n // note that 'null >= 0' evaluates to true which means 'rowGroupIndex = null' would enable row\n // grouping if the null check didn't exist above.\n include = index >= 0;\n }\n }\n else {\n if (colIsNew) {\n // as no value or index is 'present' we use the default / initial when col is new\n if (initialValuePresent) {\n include = initialValue;\n }\n else if (initialIndexPresent) {\n include = initialIndex != null && initialIndex >= 0;\n }\n else {\n include = false;\n }\n }\n else {\n // otherwise include it if included last time, e.g. if we are extracting row group cols and this col\n // is an existing row group col (i.e. it exists in 'previousCols') then we should include it.\n include = previousCols.indexOf(col) >= 0;\n }\n }\n if (include) {\n const useIndex = colIsNew ? (index != null || initialIndex != null) : index != null;\n useIndex ? colsWithIndex.push(col) : colsWithValue.push(col);\n }\n });\n const getIndexForCol = (col) => {\n const index = getIndexFunc(col.getColDef());\n const defaultIndex = getInitialIndexFunc(col.getColDef());\n return index != null ? index : defaultIndex;\n };\n // sort cols with index, and add these first\n colsWithIndex.sort((colA, colB) => {\n const indexA = getIndexForCol(colA);\n const indexB = getIndexForCol(colB);\n if (indexA === indexB) {\n return 0;\n }\n if (indexA < indexB) {\n return -1;\n }\n return 1;\n });\n const res = [].concat(colsWithIndex);\n // second add columns that were there before and in the same order as they were before,\n // so we are preserving order of current grouping of columns that simply have rowGroup=true\n previousCols.forEach(col => {\n if (colsWithValue.indexOf(col) >= 0) {\n res.push(col);\n }\n });\n // lastly put in all remaining cols\n colsWithValue.forEach(col => {\n if (res.indexOf(col) < 0) {\n res.push(col);\n }\n });\n // set flag=false for removed cols\n previousCols.forEach(col => {\n if (res.indexOf(col) < 0) {\n setFlagFunc(col, false);\n }\n });\n // set flag=true for newly added cols\n res.forEach(col => {\n if (previousCols.indexOf(col) < 0) {\n setFlagFunc(col, true);\n }\n });\n return res;\n }\n extractPivotColumns(source, oldPrimaryColumns) {\n this.pivotColumns = this.extractColumns(oldPrimaryColumns, this.pivotColumns, (col, flag) => col.setPivotActive(flag, source), (colDef) => colDef.pivotIndex, (colDef) => colDef.initialPivotIndex, (colDef) => colDef.pivot, (colDef) => colDef.initialPivot);\n }\n resetColumnGroupState(source = \"api\") {\n const stateItems = [];\n this.columnUtils.depthFirstOriginalTreeSearch(null, this.primaryColumnTree, child => {\n if (child instanceof ProvidedColumnGroup) {\n const colGroupDef = child.getColGroupDef();\n const groupState = {\n groupId: child.getGroupId(),\n open: !colGroupDef ? undefined : colGroupDef.openByDefault\n };\n stateItems.push(groupState);\n }\n });\n this.setColumnGroupState(stateItems, source);\n }\n getColumnGroupState() {\n const columnGroupState = [];\n this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, node => {\n if (node instanceof ProvidedColumnGroup) {\n columnGroupState.push({\n groupId: node.getGroupId(),\n open: node.isExpanded()\n });\n }\n });\n return columnGroupState;\n }\n setColumnGroupState(stateItems, source = \"api\") {\n this.columnAnimationService.start();\n const impactedGroups = [];\n stateItems.forEach(stateItem => {\n const groupKey = stateItem.groupId;\n const newValue = stateItem.open;\n const providedColumnGroup = this.getProvidedColumnGroup(groupKey);\n if (!providedColumnGroup) {\n return;\n }\n if (providedColumnGroup.isExpanded() === newValue) {\n return;\n }\n this.logger.log('columnGroupOpened(' + providedColumnGroup.getGroupId() + ',' + newValue + ')');\n providedColumnGroup.setExpanded(newValue);\n impactedGroups.push(providedColumnGroup);\n });\n this.updateGroupsAndDisplayedColumns(source);\n this.setFirstRightAndLastLeftPinned(source);\n impactedGroups.forEach(providedColumnGroup => {\n const event = {\n type: Events.EVENT_COLUMN_GROUP_OPENED,\n columnGroup: providedColumnGroup\n };\n this.eventService.dispatchEvent(event);\n });\n this.columnAnimationService.finish();\n }\n // called by headerRenderer - when a header is opened or closed\n setColumnGroupOpened(key, newValue, source = \"api\") {\n let keyAsString;\n if (key instanceof ProvidedColumnGroup) {\n keyAsString = key.getId();\n }\n else {\n keyAsString = key || '';\n }\n this.setColumnGroupState([{ groupId: keyAsString, open: newValue }], source);\n }\n getProvidedColumnGroup(key) {\n // if (key instanceof ProvidedColumnGroup) { return key; }\n if (typeof key !== 'string') {\n console.error('AG Grid: group key must be a string');\n }\n // otherwise, search for the column group by id\n let res = null;\n this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, node => {\n if (node instanceof ProvidedColumnGroup) {\n if (node.getId() === key) {\n res = node;\n }\n }\n });\n return res;\n }\n calculateColumnsForDisplay() {\n let columnsForDisplay;\n if (this.pivotMode && missing(this.secondaryColumns)) {\n // pivot mode is on, but we are not pivoting, so we only\n // show columns we are aggregating on\n columnsForDisplay = this.gridColumns.filter(column => {\n const isAutoGroupCol = this.groupAutoColumns && includes(this.groupAutoColumns, column);\n const isValueCol = this.valueColumns && includes(this.valueColumns, column);\n return isAutoGroupCol || isValueCol;\n });\n }\n else {\n // otherwise continue as normal. this can be working on the primary\n // or secondary columns, whatever the gridColumns are set to\n columnsForDisplay = this.gridColumns.filter(column => {\n // keep col if a) it's auto-group or b) it's visible\n const isAutoGroupCol = this.groupAutoColumns && includes(this.groupAutoColumns, column);\n return isAutoGroupCol || column.isVisible();\n });\n }\n return columnsForDisplay;\n }\n checkColSpanActiveInCols(columns) {\n let result = false;\n columns.forEach(col => {\n if (exists(col.getColDef().colSpan)) {\n result = true;\n }\n });\n return result;\n }\n calculateColumnsForGroupDisplay() {\n this.groupDisplayColumns = [];\n this.groupDisplayColumnsMap = {};\n const checkFunc = (col) => {\n const colDef = col.getColDef();\n const underlyingColumn = colDef.showRowGroup;\n if (colDef && exists(underlyingColumn)) {\n this.groupDisplayColumns.push(col);\n if (typeof underlyingColumn === 'string') {\n this.groupDisplayColumnsMap[underlyingColumn] = col;\n }\n else if (underlyingColumn === true) {\n this.getRowGroupColumns().forEach(rowGroupCol => {\n this.groupDisplayColumnsMap[rowGroupCol.getId()] = col;\n });\n }\n }\n };\n this.gridColumns.forEach(checkFunc);\n }\n getGroupDisplayColumns() {\n return this.groupDisplayColumns;\n }\n getGroupDisplayColumnForGroup(rowGroupColumnId) {\n return this.groupDisplayColumnsMap[rowGroupColumnId];\n }\n updateDisplayedColumns(source) {\n const columnsForDisplay = this.calculateColumnsForDisplay();\n this.buildDisplayedTrees(columnsForDisplay);\n // also called when group opened/closed\n this.updateGroupsAndDisplayedColumns(source);\n // also called when group opened/closed\n this.setFirstRightAndLastLeftPinned(source);\n }\n isSecondaryColumnsPresent() {\n return exists(this.secondaryColumns);\n }\n setSecondaryColumns(colDefs, source = \"api\") {\n const newColsPresent = colDefs && colDefs.length > 0;\n // if not cols passed, and we had no cols anyway, then do nothing\n if (!newColsPresent && missing(this.secondaryColumns)) {\n return;\n }\n if (newColsPresent) {\n this.processSecondaryColumnDefinitions(colDefs);\n const balancedTreeResult = this.columnFactory.createColumnTree(colDefs, false, this.secondaryBalancedTree || this.previousSecondaryColumns || undefined);\n this.destroyOldColumns(this.secondaryBalancedTree, balancedTreeResult.columnTree);\n this.secondaryBalancedTree = balancedTreeResult.columnTree;\n this.secondaryHeaderRowCount = balancedTreeResult.treeDept + 1;\n this.secondaryColumns = this.getColumnsFromTree(this.secondaryBalancedTree);\n this.secondaryColumnsMap = {};\n this.secondaryColumns.forEach(col => this.secondaryColumnsMap[col.getId()] = col);\n this.previousSecondaryColumns = null;\n }\n else {\n this.previousSecondaryColumns = this.secondaryBalancedTree;\n this.secondaryBalancedTree = null;\n this.secondaryHeaderRowCount = -1;\n this.secondaryColumns = null;\n this.secondaryColumnsMap = {};\n }\n this.updateGridColumns();\n this.updateDisplayedColumns(source);\n }\n processSecondaryColumnDefinitions(colDefs) {\n const columnCallback = this.gridOptionsService.get('processPivotResultColDef') || this.gridOptionsService.get('processSecondaryColDef');\n const groupCallback = this.gridOptionsService.get('processPivotResultColGroupDef') || this.gridOptionsService.get('processSecondaryColGroupDef');\n if (!columnCallback && !groupCallback) {\n return undefined;\n }\n const searchForColDefs = (colDefs2) => {\n colDefs2.forEach((abstractColDef) => {\n const isGroup = exists(abstractColDef.children);\n if (isGroup) {\n const colGroupDef = abstractColDef;\n if (groupCallback) {\n groupCallback(colGroupDef);\n }\n searchForColDefs(colGroupDef.children);\n }\n else {\n const colDef = abstractColDef;\n if (columnCallback) {\n columnCallback(colDef);\n }\n }\n });\n };\n if (colDefs) {\n searchForColDefs(colDefs);\n }\n }\n // called from: applyColumnState, setColumnDefs, setSecondaryColumns\n updateGridColumns() {\n const prevGridCols = this.gridBalancedTree;\n if (this.gridColsArePrimary) {\n this.lastPrimaryOrder = this.gridColumns;\n }\n else {\n this.lastSecondaryOrder = this.gridColumns;\n }\n let sortOrderToRecover;\n if (this.secondaryColumns && this.secondaryBalancedTree) {\n const hasSameColumns = this.secondaryColumns.every((col) => {\n return this.gridColumnsMap[col.getColId()] !== undefined;\n });\n this.gridBalancedTree = this.secondaryBalancedTree.slice();\n this.gridHeaderRowCount = this.secondaryHeaderRowCount;\n this.gridColumns = this.secondaryColumns.slice();\n this.gridColsArePrimary = false;\n // If the current columns are the same or a subset of the previous\n // we keep the previous order, otherwise we go back to the order the pivot\n // cols are generated in\n if (hasSameColumns) {\n sortOrderToRecover = this.lastSecondaryOrder;\n }\n }\n else if (this.primaryColumns) {\n this.gridBalancedTree = this.primaryColumnTree.slice();\n this.gridHeaderRowCount = this.primaryHeaderRowCount;\n this.gridColumns = this.primaryColumns.slice();\n this.gridColsArePrimary = true;\n // updateGridColumns gets called after user adds a row group. we want to maintain the order of the columns\n // when this happens (eg if user moved a column) rather than revert back to the original column order.\n // likewise if changing in/out of pivot mode, we want to maintain the order of the cols\n sortOrderToRecover = this.lastPrimaryOrder;\n }\n // create the new auto columns\n const areAutoColsChanged = this.createGroupAutoColumnsIfNeeded();\n // if auto group cols have changed, and we have a sort order, we need to move auto cols to the start\n if (areAutoColsChanged && sortOrderToRecover) {\n const groupAutoColsMap = convertToMap(this.groupAutoColumns.map(col => [col, true]));\n // if group columns has changed, we don't preserve the group column order, so remove them from the old order\n sortOrderToRecover = sortOrderToRecover.filter(col => !groupAutoColsMap.has(col));\n // and add them to the start of the order\n sortOrderToRecover = [...this.groupAutoColumns, ...sortOrderToRecover];\n }\n this.addAutoGroupToGridColumns();\n this.orderGridColsLike(sortOrderToRecover);\n this.gridColumns = this.placeLockedColumns(this.gridColumns);\n this.calculateColumnsForGroupDisplay();\n this.refreshQuickFilterColumns();\n this.clearDisplayedAndViewportColumns();\n this.colSpanActive = this.checkColSpanActiveInCols(this.gridColumns);\n this.gridColumnsMap = {};\n this.gridColumns.forEach(col => this.gridColumnsMap[col.getId()] = col);\n this.setAutoHeightActive();\n if (!areEqual(prevGridCols, this.gridBalancedTree)) {\n const event = {\n type: Events.EVENT_GRID_COLUMNS_CHANGED\n };\n this.eventService.dispatchEvent(event);\n }\n }\n setAutoHeightActive() {\n this.autoHeightActive = this.gridColumns.filter(col => col.isAutoHeight()).length > 0;\n if (this.autoHeightActive) {\n this.autoHeightActiveAtLeastOnce = true;\n const supportedRowModel = this.gridOptionsService.isRowModelType('clientSide') || this.gridOptionsService.isRowModelType('serverSide');\n if (!supportedRowModel) {\n const message = 'AG Grid - autoHeight columns only work with Client Side Row Model and Server Side Row Model.';\n doOnce(() => console.warn(message), 'autoHeightActive.wrongRowModel');\n }\n }\n }\n orderGridColsLike(colsOrder) {\n if (missing(colsOrder)) {\n return;\n }\n const lastOrderMapped = convertToMap(colsOrder.map((col, index) => [col, index]));\n // only do the sort if at least one column is accounted for. columns will be not accounted for\n // if changing from secondary to primary columns\n let noColsFound = true;\n this.gridColumns.forEach(col => {\n if (lastOrderMapped.has(col)) {\n noColsFound = false;\n }\n });\n if (noColsFound) {\n return;\n }\n // order cols in the same order as before. we need to make sure that all\n // cols still exists, so filter out any that no longer exist.\n const gridColsMap = convertToMap(this.gridColumns.map(col => [col, true]));\n const oldColsOrdered = colsOrder.filter(col => gridColsMap.has(col));\n const oldColsMap = convertToMap(oldColsOrdered.map(col => [col, true]));\n const newColsOrdered = this.gridColumns.filter(col => !oldColsMap.has(col));\n // add in the new columns, at the end (if no group), or at the end of the group (if a group)\n const newGridColumns = oldColsOrdered.slice();\n newColsOrdered.forEach(newCol => {\n let parent = newCol.getOriginalParent();\n // if no parent, means we are not grouping, so just add the column to the end\n if (!parent) {\n newGridColumns.push(newCol);\n return;\n }\n // find the group the column belongs to. if no siblings at the current level (eg col in group on it's\n // own) then go up one level and look for siblings there.\n const siblings = [];\n while (!siblings.length && parent) {\n const leafCols = parent.getLeafColumns();\n leafCols.forEach(leafCol => {\n const presentInNewGriColumns = newGridColumns.indexOf(leafCol) >= 0;\n const noYetInSiblings = siblings.indexOf(leafCol) < 0;\n if (presentInNewGriColumns && noYetInSiblings) {\n siblings.push(leafCol);\n }\n });\n parent = parent.getOriginalParent();\n }\n // if no siblings exist at any level, this means the col is in a group (or parent groups) on it's own\n if (!siblings.length) {\n newGridColumns.push(newCol);\n return;\n }\n // find index of last column in the group\n const indexes = siblings.map(col => newGridColumns.indexOf(col));\n const lastIndex = Math.max(...indexes);\n insertIntoArray(newGridColumns, newCol, lastIndex + 1);\n });\n this.gridColumns = newGridColumns;\n }\n isPrimaryColumnGroupsPresent() {\n return this.primaryHeaderRowCount > 1;\n }\n // if we are using autoGroupCols, then they should be included for quick filter. this covers the\n // following scenarios:\n // a) user provides 'field' into autoGroupCol of normal grid, so now because a valid col to filter leafs on\n // b) using tree data and user depends on autoGroupCol for first col, and we also want to filter on this\n // (tree data is a bit different, as parent rows can be filtered on, unlike row grouping)\n refreshQuickFilterColumns() {\n var _a;\n let columnsForQuickFilter = (_a = (this.isPivotMode() ? this.secondaryColumns : this.primaryColumns)) !== null && _a !== void 0 ? _a : [];\n if (this.groupAutoColumns) {\n columnsForQuickFilter = columnsForQuickFilter.concat(this.groupAutoColumns);\n }\n this.columnsForQuickFilter = this.gridOptionsService.is('includeHiddenColumnsInQuickFilter')\n ? columnsForQuickFilter\n : columnsForQuickFilter.filter(col => col.isVisible() || col.isRowGroupActive());\n }\n placeLockedColumns(cols) {\n const left = [];\n const normal = [];\n const right = [];\n cols.forEach((col) => {\n const position = col.getColDef().lockPosition;\n if (position === 'right') {\n right.push(col);\n }\n else if (position === 'left' || position === true) {\n left.push(col);\n }\n else {\n normal.push(col);\n }\n });\n return [...left, ...normal, ...right];\n }\n addAutoGroupToGridColumns() {\n if (missing(this.groupAutoColumns)) {\n this.destroyOldColumns(this.groupAutoColsBalancedTree);\n this.groupAutoColsBalancedTree = null;\n return;\n }\n this.gridColumns = this.groupAutoColumns ? this.groupAutoColumns.concat(this.gridColumns) : this.gridColumns;\n const newAutoColsTree = this.columnFactory.createForAutoGroups(this.groupAutoColumns, this.gridBalancedTree);\n this.destroyOldColumns(this.groupAutoColsBalancedTree, newAutoColsTree);\n this.groupAutoColsBalancedTree = newAutoColsTree;\n this.gridBalancedTree = newAutoColsTree.concat(this.gridBalancedTree);\n }\n // gets called after we copy down grid columns, to make sure any part of the gui\n // that tries to draw, eg the header, it will get empty lists of columns rather\n // than stale columns. for example, the header will received gridColumnsChanged\n // event, so will try and draw, but it will draw successfully when it acts on the\n // virtualColumnsChanged event\n clearDisplayedAndViewportColumns() {\n this.viewportRowLeft = {};\n this.viewportRowRight = {};\n this.viewportRowCenter = {};\n this.displayedColumnsLeft = [];\n this.displayedColumnsRight = [];\n this.displayedColumnsCenter = [];\n this.displayedColumns = [];\n this.viewportColumns = [];\n this.headerViewportColumns = [];\n this.viewportColumnsHash = '';\n }\n updateGroupsAndDisplayedColumns(source) {\n this.updateOpenClosedVisibilityInColumnGroups();\n this.deriveDisplayedColumns(source);\n this.refreshFlexedColumns();\n this.extractViewport();\n this.updateBodyWidths();\n // this event is picked up by the gui, headerRenderer and rowRenderer, to recalculate what columns to display\n const event = {\n type: Events.EVENT_DISPLAYED_COLUMNS_CHANGED\n };\n this.eventService.dispatchEvent(event);\n }\n deriveDisplayedColumns(source) {\n this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeLeft, this.displayedColumnsLeft);\n this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeCentre, this.displayedColumnsCenter);\n this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeRight, this.displayedColumnsRight);\n this.joinDisplayedColumns();\n this.setLeftValues(source);\n this.displayedAutoHeightCols = this.displayedColumns.filter(col => col.isAutoHeight());\n }\n isAutoRowHeightActive() {\n return this.autoHeightActive;\n }\n wasAutoRowHeightEverActive() {\n return this.autoHeightActiveAtLeastOnce;\n }\n joinDisplayedColumns() {\n if (this.gridOptionsService.is('enableRtl')) {\n this.displayedColumns = this.displayedColumnsRight\n .concat(this.displayedColumnsCenter)\n .concat(this.displayedColumnsLeft);\n }\n else {\n this.displayedColumns = this.displayedColumnsLeft\n .concat(this.displayedColumnsCenter)\n .concat(this.displayedColumnsRight);\n }\n }\n // sets the left pixel position of each column\n setLeftValues(source) {\n this.setLeftValuesOfColumns(source);\n this.setLeftValuesOfGroups();\n }\n setLeftValuesOfColumns(source) {\n if (!this.primaryColumns) {\n return;\n }\n // go through each list of displayed columns\n const allColumns = this.primaryColumns.slice(0);\n // let totalColumnWidth = this.getWidthOfColsInList()\n const doingRtl = this.gridOptionsService.is('enableRtl');\n [\n this.displayedColumnsLeft,\n this.displayedColumnsRight,\n this.displayedColumnsCenter\n ].forEach(columns => {\n if (doingRtl) {\n // when doing RTL, we start at the top most pixel (ie RHS) and work backwards\n let left = this.getWidthOfColsInList(columns);\n columns.forEach(column => {\n left -= column.getActualWidth();\n column.setLeft(left, source);\n });\n }\n else {\n // otherwise normal LTR, we start at zero\n let left = 0;\n columns.forEach(column => {\n column.setLeft(left, source);\n left += column.getActualWidth();\n });\n }\n removeAllFromUnorderedArray(allColumns, columns);\n });\n // items left in allColumns are columns not displayed, so remove the left position. this is\n // important for the rows, as if a col is made visible, then taken out, then made visible again,\n // we don't want the animation of the cell floating in from the old position, whatever that was.\n allColumns.forEach((column) => {\n column.setLeft(null, source);\n });\n }\n setLeftValuesOfGroups() {\n // a groups left value is the lest left value of it's children\n [\n this.displayedTreeLeft,\n this.displayedTreeRight,\n this.displayedTreeCentre\n ].forEach(columns => {\n columns.forEach(column => {\n if (column instanceof ColumnGroup) {\n const columnGroup = column;\n columnGroup.checkLeft();\n }\n });\n });\n }\n derivedDisplayedColumnsFromDisplayedTree(tree, columns) {\n columns.length = 0;\n this.columnUtils.depthFirstDisplayedColumnTreeSearch(tree, (child) => {\n if (child instanceof Column) {\n columns.push(child);\n }\n });\n }\n extractViewportColumns() {\n if (this.suppressColumnVirtualisation) {\n // no virtualisation, so don't filter\n this.viewportColumnsCenter = this.displayedColumnsCenter;\n this.headerViewportColumnsCenter = this.displayedColumnsCenter;\n }\n else {\n // filter out what should be visible\n this.viewportColumnsCenter = this.displayedColumnsCenter.filter(this.isColumnInRowViewport.bind(this));\n this.headerViewportColumnsCenter = this.displayedColumnsCenter.filter(this.isColumnInHeaderViewport.bind(this));\n }\n this.viewportColumns = this.viewportColumnsCenter\n .concat(this.displayedColumnsLeft)\n .concat(this.displayedColumnsRight);\n this.headerViewportColumns = this.headerViewportColumnsCenter\n .concat(this.displayedColumnsLeft)\n .concat(this.displayedColumnsRight);\n }\n getVirtualHeaderGroupRow(type, dept) {\n let result;\n switch (type) {\n case 'left':\n result = this.viewportRowLeft[dept];\n break;\n case 'right':\n result = this.viewportRowRight[dept];\n break;\n default:\n result = this.viewportRowCenter[dept];\n break;\n }\n if (missing(result)) {\n result = [];\n }\n return result;\n }\n calculateHeaderRows() {\n // go through each group, see if any of it's cols are displayed, and if yes,\n // then this group is included\n this.viewportRowLeft = {};\n this.viewportRowRight = {};\n this.viewportRowCenter = {};\n // for easy lookup when building the groups.\n const virtualColIds = {};\n this.headerViewportColumns.forEach(col => virtualColIds[col.getId()] = true);\n const testGroup = (children, result, dept) => {\n let returnValue = false;\n for (let i = 0; i < children.length; i++) {\n // see if this item is within viewport\n const child = children[i];\n let addThisItem = false;\n if (child instanceof Column) {\n // for column, test if column is included\n addThisItem = virtualColIds[child.getId()] === true;\n }\n else {\n // if group, base decision on children\n const columnGroup = child;\n const displayedChildren = columnGroup.getDisplayedChildren();\n if (displayedChildren) {\n addThisItem = testGroup(displayedChildren, result, dept + 1);\n }\n }\n if (addThisItem) {\n returnValue = true;\n if (!result[dept]) {\n result[dept] = [];\n }\n result[dept].push(child);\n }\n }\n return returnValue;\n };\n testGroup(this.displayedTreeLeft, this.viewportRowLeft, 0);\n testGroup(this.displayedTreeRight, this.viewportRowRight, 0);\n testGroup(this.displayedTreeCentre, this.viewportRowCenter, 0);\n }\n extractViewport() {\n const hashColumn = (c) => `${c.getId()}-${c.getPinned() || 'normal'}`;\n this.extractViewportColumns();\n const newHash = this.viewportColumns.map(hashColumn).join('#');\n const changed = this.viewportColumnsHash !== newHash;\n if (changed) {\n this.viewportColumnsHash = newHash;\n this.calculateHeaderRows();\n }\n return changed;\n }\n refreshFlexedColumns(params = {}) {\n var _a;\n const source = params.source ? params.source : 'flex';\n if (params.viewportWidth != null) {\n this.flexViewportWidth = params.viewportWidth;\n }\n if (!this.flexViewportWidth) {\n return [];\n }\n // If the grid has left-over space, divide it between flexing columns in proportion to their flex value.\n // A \"flexing column\" is one that has a 'flex' value set and is not currently being constrained by its\n // minWidth or maxWidth rules.\n let flexAfterDisplayIndex = -1;\n if (params.resizingCols) {\n const allResizingCols = new Set(params.resizingCols);\n // find the last resizing col, as only cols after this one are affected by the resizing\n let displayedCols = this.displayedColumnsCenter;\n for (let i = displayedCols.length - 1; i >= 0; i--) {\n if (allResizingCols.has(displayedCols[i])) {\n flexAfterDisplayIndex = i;\n break;\n }\n }\n }\n // the width of all of the columns for which the width has been determined\n let knownColumnsWidth = 0;\n let flexingColumns = [];\n // store the minimum width of all the flex columns, so we can determine if flex is even possible more quickly\n let minimumFlexedWidth = 0;\n let totalFlex = 0;\n for (let i = 0; i < this.displayedColumnsCenter.length; i++) {\n const isFlex = this.displayedColumnsCenter[i].getFlex() && i > flexAfterDisplayIndex;\n if (isFlex) {\n flexingColumns.push(this.displayedColumnsCenter[i]);\n totalFlex += this.displayedColumnsCenter[i].getFlex();\n minimumFlexedWidth += (_a = this.displayedColumnsCenter[i].getMinWidth()) !== null && _a !== void 0 ? _a : 0;\n }\n else {\n knownColumnsWidth += this.displayedColumnsCenter[i].getActualWidth();\n }\n }\n ;\n if (!flexingColumns.length) {\n return [];\n }\n let changedColumns = [];\n // this is for performance to prevent trying to flex when unnecessary\n if (knownColumnsWidth + minimumFlexedWidth > this.flexViewportWidth) {\n // known columns and the minimum width of all the flex cols are too wide for viewport\n // so don't flex\n flexingColumns.forEach(col => { var _a; return col.setActualWidth((_a = col.getMinWidth()) !== null && _a !== void 0 ? _a : 0, source); });\n // No columns should flex, but all have been changed. Swap arrays so events fire properly.\n // Expensive logic won't execute as flex columns is empty.\n changedColumns = flexingColumns;\n flexingColumns = [];\n }\n const flexingColumnSizes = [];\n let spaceForFlexingColumns;\n outer: while (true) {\n spaceForFlexingColumns = this.flexViewportWidth - knownColumnsWidth;\n const spacePerFlex = spaceForFlexingColumns / totalFlex;\n for (let i = 0; i < flexingColumns.length; i++) {\n const col = flexingColumns[i];\n const widthByFlexRule = spacePerFlex * col.getFlex();\n let constrainedWidth = 0;\n const minWidth = col.getMinWidth();\n const maxWidth = col.getMaxWidth();\n if (exists(minWidth) && widthByFlexRule < minWidth) {\n constrainedWidth = minWidth;\n }\n else if (exists(maxWidth) && widthByFlexRule > maxWidth) {\n constrainedWidth = maxWidth;\n }\n if (constrainedWidth) {\n // This column is not in fact flexing as it is being constrained to a specific size\n // so remove it from the list of flexing columns and start again\n col.setActualWidth(constrainedWidth, source);\n removeFromUnorderedArray(flexingColumns, col);\n totalFlex -= col.getFlex();\n changedColumns.push(col);\n knownColumnsWidth += col.getActualWidth();\n continue outer;\n }\n flexingColumnSizes[i] = Math.round(widthByFlexRule);\n }\n break;\n }\n let remainingSpace = spaceForFlexingColumns;\n flexingColumns.forEach((col, i) => {\n col.setActualWidth(Math.min(flexingColumnSizes[i], remainingSpace), source);\n changedColumns.push(col);\n remainingSpace -= flexingColumnSizes[i];\n });\n if (!params.skipSetLeft) {\n this.setLeftValues(source);\n }\n if (params.updateBodyWidths) {\n this.updateBodyWidths();\n }\n if (params.fireResizedEvent) {\n this.dispatchColumnResizedEvent(changedColumns, true, source, flexingColumns);\n }\n return flexingColumns;\n }\n // called from api\n sizeColumnsToFit(gridWidth, source = \"sizeColumnsToFit\", silent, params) {\n var _a, _b, _c, _d, _e;\n if (this.shouldQueueResizeOperations) {\n this.resizeOperationQueue.push(() => this.sizeColumnsToFit(gridWidth, source, silent, params));\n return;\n }\n const limitsMap = {};\n if (params) {\n (_a = params === null || params === void 0 ? void 0 : params.columnLimits) === null || _a === void 0 ? void 0 : _a.forEach((_a) => {\n var { key } = _a, dimensions = __rest(_a, [\"key\"]);\n limitsMap[typeof key === 'string' ? key : key.getColId()] = dimensions;\n });\n }\n // avoid divide by zero\n const allDisplayedColumns = this.getAllDisplayedColumns();\n const doColumnsAlreadyFit = gridWidth === this.getWidthOfColsInList(allDisplayedColumns);\n if (gridWidth <= 0 || !allDisplayedColumns.length || doColumnsAlreadyFit) {\n return;\n }\n const colsToSpread = [];\n const colsToNotSpread = [];\n allDisplayedColumns.forEach(column => {\n if (column.getColDef().suppressSizeToFit === true) {\n colsToNotSpread.push(column);\n }\n else {\n colsToSpread.push(column);\n }\n });\n // make a copy of the cols that are going to be resized\n const colsToDispatchEventFor = colsToSpread.slice(0);\n let finishedResizing = false;\n const moveToNotSpread = (column) => {\n removeFromArray(colsToSpread, column);\n colsToNotSpread.push(column);\n };\n // resetting cols to their original width makes the sizeColumnsToFit more deterministic,\n // rather than depending on the current size of the columns. most users call sizeColumnsToFit\n // immediately after grid is created, so will make no difference. however if application is calling\n // sizeColumnsToFit repeatedly (eg after column group is opened / closed repeatedly) we don't want\n // the columns to start shrinking / growing over time.\n //\n // NOTE: the process below will assign values to `this.actualWidth` of each column without firing events\n // for this reason we need to manually dispatch resize events after the resize has been done for each column.\n colsToSpread.forEach(column => {\n var _a, _b;\n column.resetActualWidth(source);\n const widthOverride = limitsMap === null || limitsMap === void 0 ? void 0 : limitsMap[column.getId()];\n const minOverride = ((_a = widthOverride === null || widthOverride === void 0 ? void 0 : widthOverride.minWidth) !== null && _a !== void 0 ? _a : params === null || params === void 0 ? void 0 : params.defaultMinWidth);\n const maxOverride = ((_b = widthOverride === null || widthOverride === void 0 ? void 0 : widthOverride.maxWidth) !== null && _b !== void 0 ? _b : params === null || params === void 0 ? void 0 : params.defaultMaxWidth);\n const colWidth = column.getActualWidth();\n if (typeof minOverride === 'number' && colWidth < minOverride) {\n column.setActualWidth(minOverride, source, true);\n }\n else if (typeof maxOverride === 'number' && colWidth > maxOverride) {\n column.setActualWidth(maxOverride, source, true);\n }\n });\n while (!finishedResizing) {\n finishedResizing = true;\n const availablePixels = gridWidth - this.getWidthOfColsInList(colsToNotSpread);\n if (availablePixels <= 0) {\n // no width, set everything to minimum\n colsToSpread.forEach((column) => {\n var _a, _b;\n const widthOverride = (_b = (_a = limitsMap === null || limitsMap === void 0 ? void 0 : limitsMap[column.getId()]) === null || _a === void 0 ? void 0 : _a.minWidth) !== null && _b !== void 0 ? _b : params === null || params === void 0 ? void 0 : params.defaultMinWidth;\n if (typeof widthOverride === 'number') {\n column.setActualWidth(widthOverride, source, true);\n return;\n }\n column.setMinimum(source);\n });\n }\n else {\n const scale = availablePixels / this.getWidthOfColsInList(colsToSpread);\n // we set the pixels for the last col based on what's left, as otherwise\n // we could be a pixel or two short or extra because of rounding errors.\n let pixelsForLastCol = availablePixels;\n // backwards through loop, as we are removing items as we go\n for (let i = colsToSpread.length - 1; i >= 0; i--) {\n const column = colsToSpread[i];\n const widthOverride = limitsMap === null || limitsMap === void 0 ? void 0 : limitsMap[column.getId()];\n const minOverride = ((_b = widthOverride === null || widthOverride === void 0 ? void 0 : widthOverride.minWidth) !== null && _b !== void 0 ? _b : params === null || params === void 0 ? void 0 : params.defaultMinWidth);\n const maxOverride = ((_c = widthOverride === null || widthOverride === void 0 ? void 0 : widthOverride.maxWidth) !== null && _c !== void 0 ? _c : params === null || params === void 0 ? void 0 : params.defaultMaxWidth);\n const colMinWidth = (_d = column.getMinWidth()) !== null && _d !== void 0 ? _d : 0;\n const colMaxWidth = (_e = column.getMaxWidth()) !== null && _e !== void 0 ? _e : Number.MAX_VALUE;\n const minWidth = typeof minOverride === 'number' && minOverride > colMinWidth ? minOverride : column.getMinWidth();\n const maxWidth = typeof maxOverride === 'number' && maxOverride < colMaxWidth ? maxOverride : column.getMaxWidth();\n let newWidth = Math.round(column.getActualWidth() * scale);\n if (exists(minWidth) && newWidth < minWidth) {\n newWidth = minWidth;\n moveToNotSpread(column);\n finishedResizing = false;\n }\n else if (exists(maxWidth) && newWidth > maxWidth) {\n newWidth = maxWidth;\n moveToNotSpread(column);\n finishedResizing = false;\n }\n else if (i === 0) { // if this is the last column\n newWidth = pixelsForLastCol;\n }\n column.setActualWidth(newWidth, source, true);\n pixelsForLastCol -= newWidth;\n }\n }\n }\n // see notes above\n colsToDispatchEventFor.forEach(col => {\n col.fireColumnWidthChangedEvent(source);\n });\n this.setLeftValues(source);\n this.updateBodyWidths();\n if (silent) {\n return;\n }\n this.dispatchColumnResizedEvent(colsToDispatchEventFor, true, source);\n }\n buildDisplayedTrees(visibleColumns) {\n const leftVisibleColumns = [];\n const rightVisibleColumns = [];\n const centerVisibleColumns = [];\n visibleColumns.forEach(column => {\n switch (column.getPinned()) {\n case \"left\":\n leftVisibleColumns.push(column);\n break;\n case \"right\":\n rightVisibleColumns.push(column);\n break;\n default:\n centerVisibleColumns.push(column);\n break;\n }\n });\n const groupInstanceIdCreator = new GroupInstanceIdCreator();\n this.displayedTreeLeft = this.displayedGroupCreator.createDisplayedGroups(leftVisibleColumns, groupInstanceIdCreator, 'left', this.displayedTreeLeft);\n this.displayedTreeRight = this.displayedGroupCreator.createDisplayedGroups(rightVisibleColumns, groupInstanceIdCreator, 'right', this.displayedTreeRight);\n this.displayedTreeCentre = this.displayedGroupCreator.createDisplayedGroups(centerVisibleColumns, groupInstanceIdCreator, null, this.displayedTreeCentre);\n this.updateDisplayedMap();\n }\n updateDisplayedMap() {\n this.displayedColumnsAndGroupsMap = {};\n const func = (child) => {\n this.displayedColumnsAndGroupsMap[child.getUniqueId()] = child;\n };\n this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeCentre, func);\n this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeLeft, func);\n this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeRight, func);\n }\n isDisplayed(item) {\n const fromMap = this.displayedColumnsAndGroupsMap[item.getUniqueId()];\n // check for reference, in case new column / group with same id is now present\n return fromMap === item;\n }\n updateOpenClosedVisibilityInColumnGroups() {\n const allColumnGroups = this.getAllDisplayedTrees();\n this.columnUtils.depthFirstAllColumnTreeSearch(allColumnGroups, child => {\n if (child instanceof ColumnGroup) {\n child.calculateDisplayedColumns();\n }\n });\n }\n getGroupAutoColumns() {\n return this.groupAutoColumns;\n }\n /**\n * Creates new auto group columns if required\n * @returns whether auto cols have changed\n */\n createGroupAutoColumnsIfNeeded() {\n const forceRecreateAutoGroups = this.forceRecreateAutoGroups;\n this.forceRecreateAutoGroups = false;\n if (!this.autoGroupsNeedBuilding) {\n return false;\n }\n this.autoGroupsNeedBuilding = false;\n const groupFullWidthRow = this.gridOptionsService.isGroupUseEntireRow(this.pivotMode);\n // we need to allow suppressing auto-column separately for group and pivot as the normal situation\n // is CSRM and user provides group column themselves for normal view, but when they go into pivot the\n // columns are generated by the grid so no opportunity for user to provide group column. so need a way\n // to suppress auto-col for grouping only, and not pivot.\n // however if using Viewport RM or SSRM and user is providing the columns, the user may wish full control\n // of the group column in this instance.\n const suppressAutoColumn = this.pivotMode ?\n this.gridOptionsService.is('pivotSuppressAutoColumn') : this.isGroupSuppressAutoColumn();\n const groupingActive = this.rowGroupColumns.length > 0 || this.usingTreeData;\n const needAutoColumns = groupingActive && !suppressAutoColumn && !groupFullWidthRow;\n if (needAutoColumns) {\n const newAutoGroupCols = this.autoGroupColService.createAutoGroupColumns(this.rowGroupColumns);\n const autoColsDifferent = !this.autoColsEqual(newAutoGroupCols, this.groupAutoColumns);\n // we force recreate so new group cols pick up the new\n // definitions. otherwise we could ignore the new cols because they appear to be the same.\n if (autoColsDifferent || forceRecreateAutoGroups) {\n this.groupAutoColumns = newAutoGroupCols;\n return true;\n }\n }\n else {\n this.groupAutoColumns = null;\n }\n return false;\n }\n isGroupSuppressAutoColumn() {\n const groupDisplayType = this.gridOptionsService.get('groupDisplayType');\n const isCustomRowGroups = groupDisplayType ? matchesGroupDisplayType('custom', groupDisplayType) : false;\n if (isCustomRowGroups) {\n return true;\n }\n const treeDataDisplayType = this.gridOptionsService.get('treeDataDisplayType');\n return treeDataDisplayType ? matchesTreeDataDisplayType('custom', treeDataDisplayType) : false;\n }\n autoColsEqual(colsA, colsB) {\n return areEqual(colsA, colsB, (a, b) => a.getColId() === b.getColId());\n }\n getWidthOfColsInList(columnList) {\n return columnList.reduce((width, col) => width + col.getActualWidth(), 0);\n }\n getGridBalancedTree() {\n return this.gridBalancedTree;\n }\n getFirstDisplayedColumn() {\n const isRtl = this.gridOptionsService.is('enableRtl');\n const queryOrder = [\n 'getDisplayedLeftColumns',\n 'getDisplayedCenterColumns',\n 'getDisplayedRightColumns'\n ];\n if (isRtl) {\n queryOrder.reverse();\n }\n for (let i = 0; i < queryOrder.length; i++) {\n const container = this[queryOrder[i]]();\n if (container.length) {\n return isRtl ? last(container) : container[0];\n }\n }\n return null;\n }\n setColumnHeaderHeight(col, height) {\n const changed = col.setAutoHeaderHeight(height);\n if (changed) {\n const event = {\n type: Events.EVENT_COLUMN_HEADER_HEIGHT_CHANGED,\n column: col,\n columns: [col],\n source: 'autosizeColumnHeaderHeight',\n };\n this.eventService.dispatchEvent(event);\n }\n }\n getColumnGroupHeaderRowHeight() {\n if (this.isPivotMode()) {\n return this.getPivotGroupHeaderHeight();\n }\n return this.getGroupHeaderHeight();\n }\n getColumnHeaderRowHeight() {\n const defaultHeight = (this.isPivotMode() ?\n this.getPivotHeaderHeight() :\n this.getHeaderHeight());\n const displayedHeights = this.getAllDisplayedColumns()\n .filter((col) => col.isAutoHeaderHeight())\n .map((col) => col.getAutoHeaderHeight() || 0);\n return Math.max(defaultHeight, ...displayedHeights);\n }\n getHeaderHeight() {\n var _a;\n return (_a = this.gridOptionsService.getNum('headerHeight')) !== null && _a !== void 0 ? _a : this.environment.getFromTheme(25, 'headerHeight');\n }\n getFloatingFiltersHeight() {\n var _a;\n return (_a = this.gridOptionsService.getNum('floatingFiltersHeight')) !== null && _a !== void 0 ? _a : this.getHeaderHeight();\n }\n getGroupHeaderHeight() {\n var _a;\n return (_a = this.gridOptionsService.getNum('groupHeaderHeight')) !== null && _a !== void 0 ? _a : this.getHeaderHeight();\n }\n getPivotHeaderHeight() {\n var _a;\n return (_a = this.gridOptionsService.getNum('pivotHeaderHeight')) !== null && _a !== void 0 ? _a : this.getHeaderHeight();\n }\n getPivotGroupHeaderHeight() {\n var _a;\n return (_a = this.gridOptionsService.getNum('pivotGroupHeaderHeight')) !== null && _a !== void 0 ? _a : this.getGroupHeaderHeight();\n }\n queueResizeOperations() {\n this.shouldQueueResizeOperations = true;\n }\n processResizeOperations() {\n this.shouldQueueResizeOperations = false;\n this.resizeOperationQueue.forEach(resizeOperation => resizeOperation());\n this.resizeOperationQueue = [];\n }\n resetColumnDefIntoColumn(column) {\n const userColDef = column.getUserProvidedColDef();\n if (!userColDef) {\n return false;\n }\n const newColDef = this.columnFactory.addColumnDefaultAndTypes(userColDef, column.getColId());\n column.setColDef(newColDef, userColDef);\n return true;\n }\n generateColumnStateForRowGroupAndPivotIndexes(updatedRowGroupColumnState, updatedPivotColumnState) {\n // Generally columns should appear in the order they were before. For any new columns, these should appear in the original col def order.\n // The exception is for columns that were added via `addGroupColumns`. These should appear at the end.\n // We don't have to worry about full updates, as in this case the arrays are correct, and they won't appear in the updated lists.\n let existingColumnStateUpdates = {};\n const orderColumns = (updatedColumnState, colList, enableProp, initialEnableProp, indexProp, initialIndexProp) => {\n if (!colList.length || !this.primaryColumns) {\n return [];\n }\n const updatedColIdArray = Object.keys(updatedColumnState);\n const updatedColIds = new Set(updatedColIdArray);\n const newColIds = new Set(updatedColIdArray);\n const allColIds = new Set(colList.map(column => {\n const colId = column.getColId();\n newColIds.delete(colId);\n return colId;\n }).concat(updatedColIdArray));\n const colIdsInOriginalOrder = [];\n const originalOrderMap = {};\n let orderIndex = 0;\n for (let i = 0; i < this.primaryColumns.length; i++) {\n const colId = this.primaryColumns[i].getColId();\n if (allColIds.has(colId)) {\n colIdsInOriginalOrder.push(colId);\n originalOrderMap[colId] = orderIndex++;\n }\n }\n // follow approach in `resetColumnState`\n let index = 1000;\n let hasAddedNewCols = false;\n let lastIndex = 0;\n const processPrecedingNewCols = (colId) => {\n const originalOrderIndex = originalOrderMap[colId];\n for (let i = lastIndex; i < originalOrderIndex; i++) {\n const newColId = colIdsInOriginalOrder[i];\n if (newColIds.has(newColId)) {\n updatedColumnState[newColId][indexProp] = index++;\n newColIds.delete(newColId);\n }\n }\n lastIndex = originalOrderIndex;\n };\n colList.forEach(column => {\n const colId = column.getColId();\n if (updatedColIds.has(colId)) {\n // New col already exists. Add any other new cols that should be before it.\n processPrecedingNewCols(colId);\n updatedColumnState[colId][indexProp] = index++;\n }\n else {\n const colDef = column.getColDef();\n const missingIndex = colDef[indexProp] === null || (colDef[indexProp] === undefined && colDef[initialIndexProp] == null);\n if (missingIndex) {\n if (!hasAddedNewCols) {\n const propEnabled = colDef[enableProp] || (colDef[enableProp] === undefined && colDef[initialEnableProp]);\n if (propEnabled) {\n processPrecedingNewCols(colId);\n }\n else {\n // Reached the first manually added column. Add all the new columns now.\n newColIds.forEach(newColId => {\n // Rather than increment the index, just use the original order index - doesn't need to be contiguous.\n updatedColumnState[newColId][indexProp] = index + originalOrderMap[newColId];\n });\n index += colIdsInOriginalOrder.length;\n hasAddedNewCols = true;\n }\n }\n if (!existingColumnStateUpdates[colId]) {\n existingColumnStateUpdates[colId] = { colId };\n }\n existingColumnStateUpdates[colId][indexProp] = index++;\n }\n }\n });\n };\n orderColumns(updatedRowGroupColumnState, this.rowGroupColumns, 'rowGroup', 'initialRowGroup', 'rowGroupIndex', 'initialRowGroupIndex');\n orderColumns(updatedPivotColumnState, this.pivotColumns, 'pivot', 'initialPivot', 'pivotIndex', 'initialPivotIndex');\n return Object.values(existingColumnStateUpdates);\n }\n};\n__decorate([\n Autowired('expressionService')\n], ColumnModel.prototype, \"expressionService\", void 0);\n__decorate([\n Autowired('columnFactory')\n], ColumnModel.prototype, \"columnFactory\", void 0);\n__decorate([\n Autowired('displayedGroupCreator')\n], ColumnModel.prototype, \"displayedGroupCreator\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], ColumnModel.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('autoWidthCalculator')\n], ColumnModel.prototype, \"autoWidthCalculator\", void 0);\n__decorate([\n Autowired('columnUtils')\n], ColumnModel.prototype, \"columnUtils\", void 0);\n__decorate([\n Autowired('columnAnimationService')\n], ColumnModel.prototype, \"columnAnimationService\", void 0);\n__decorate([\n Autowired('autoGroupColService')\n], ColumnModel.prototype, \"autoGroupColService\", void 0);\n__decorate([\n Optional('aggFuncService')\n], ColumnModel.prototype, \"aggFuncService\", void 0);\n__decorate([\n Optional('valueCache')\n], ColumnModel.prototype, \"valueCache\", void 0);\n__decorate([\n Optional('animationFrameService')\n], ColumnModel.prototype, \"animationFrameService\", void 0);\n__decorate([\n Autowired('sortController')\n], ColumnModel.prototype, \"sortController\", void 0);\n__decorate([\n Autowired('columnDefFactory')\n], ColumnModel.prototype, \"columnDefFactory\", void 0);\n__decorate([\n PostConstruct\n], ColumnModel.prototype, \"init\", null);\n__decorate([\n PreDestroy\n], ColumnModel.prototype, \"destroyColumns\", null);\n__decorate([\n __param(0, Qualifier('loggerFactory'))\n], ColumnModel.prototype, \"setBeans\", null);\nColumnModel = __decorate([\n Bean('columnModel')\n], ColumnModel);\nexport { ColumnModel };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { ColumnGroup } from \"../entities/columnGroup.mjs\";\nimport { ProvidedColumnGroup } from \"../entities/providedColumnGroup.mjs\";\nimport { Bean } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { attrToNumber } from \"../utils/generic.mjs\";\n// takes in a list of columns, as specified by the column definitions, and returns column groups\nlet ColumnUtils = class ColumnUtils extends BeanStub {\n calculateColMinWidth(colDef) {\n return colDef.minWidth != null ? colDef.minWidth : this.environment.getMinColWidth();\n }\n calculateColMaxWidth(colDef) {\n return colDef.maxWidth != null ? colDef.maxWidth : Number.MAX_SAFE_INTEGER;\n }\n calculateColInitialWidth(colDef) {\n const minColWidth = this.calculateColMinWidth(colDef);\n const maxColWidth = this.calculateColMaxWidth(colDef);\n let width;\n const colDefWidth = attrToNumber(colDef.width);\n const colDefInitialWidth = attrToNumber(colDef.initialWidth);\n if (colDefWidth != null) {\n width = colDefWidth;\n }\n else if (colDefInitialWidth != null) {\n width = colDefInitialWidth;\n }\n else {\n width = 200;\n }\n return Math.max(Math.min(width, maxColWidth), minColWidth);\n }\n getOriginalPathForColumn(column, originalBalancedTree) {\n const result = [];\n let found = false;\n const recursePath = (balancedColumnTree, dept) => {\n for (let i = 0; i < balancedColumnTree.length; i++) {\n if (found) {\n return;\n }\n // quit the search, so 'result' is kept with the found result\n const node = balancedColumnTree[i];\n if (node instanceof ProvidedColumnGroup) {\n const nextNode = node;\n recursePath(nextNode.getChildren(), dept + 1);\n result[dept] = node;\n }\n else if (node === column) {\n found = true;\n }\n }\n };\n recursePath(originalBalancedTree, 0);\n // we should always find the path, but in case there is a bug somewhere, returning null\n // will make it fail rather than provide a 'hard to track down' bug\n return found ? result : null;\n }\n depthFirstOriginalTreeSearch(parent, tree, callback) {\n if (!tree) {\n return;\n }\n tree.forEach((child) => {\n if (child instanceof ProvidedColumnGroup) {\n this.depthFirstOriginalTreeSearch(child, child.getChildren(), callback);\n }\n callback(child, parent);\n });\n }\n depthFirstAllColumnTreeSearch(tree, callback) {\n if (!tree) {\n return;\n }\n tree.forEach((child) => {\n if (child instanceof ColumnGroup) {\n this.depthFirstAllColumnTreeSearch(child.getChildren(), callback);\n }\n callback(child);\n });\n }\n depthFirstDisplayedColumnTreeSearch(tree, callback) {\n if (!tree) {\n return;\n }\n tree.forEach((child) => {\n if (child instanceof ColumnGroup) {\n this.depthFirstDisplayedColumnTreeSearch(child.getDisplayedChildren(), callback);\n }\n callback(child);\n });\n }\n};\nColumnUtils = __decorate([\n Bean('columnUtils')\n], ColumnUtils);\nexport { ColumnUtils };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { ColumnGroup } from \"../entities/columnGroup.mjs\";\nimport { Bean } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\n// takes in a list of columns, as specified by the column definitions, and returns column groups\nlet DisplayedGroupCreator = class DisplayedGroupCreator extends BeanStub {\n createDisplayedGroups(\n // all displayed columns sorted - this is the columns the grid should show\n sortedVisibleColumns, \n // creates unique id's for the group\n groupInstanceIdCreator, \n // whether it's left, right or center col\n pinned, \n // we try to reuse old groups if we can, to allow gui to do animation\n oldDisplayedGroups) {\n const oldColumnsMapped = this.mapOldGroupsById(oldDisplayedGroups);\n /**\n * The following logic starts at the leaf level of columns, iterating through them to build their parent\n * groups when the parents match.\n *\n * The created groups are then added to an array, and similarly iterated on until we reach the top level.\n *\n * When row groups have no original parent, it's added to the result.\n */\n const topLevelResultCols = [];\n // this is an array of cols or col groups at one level of depth, starting from leaf and ending at root\n let groupsOrColsAtCurrentLevel = sortedVisibleColumns;\n while (groupsOrColsAtCurrentLevel.length) {\n // store what's currently iterating so the function can build the next level of col groups\n const currentlyIterating = groupsOrColsAtCurrentLevel;\n groupsOrColsAtCurrentLevel = [];\n // store the index of the last row which was different from the previous row, this is used as a slice\n // index for finding the children to group together\n let lastGroupedColIdx = 0;\n // create a group of children from lastGroupedColIdx to the provided `to` parameter\n const createGroupToIndex = (to) => {\n const from = lastGroupedColIdx;\n lastGroupedColIdx = to;\n const previousNode = currentlyIterating[from];\n const previousNodeProvided = previousNode instanceof ColumnGroup ? previousNode.getProvidedColumnGroup() : previousNode;\n const previousNodeParent = previousNodeProvided.getOriginalParent();\n if (previousNodeParent == null) {\n // if the last node was different, and had a null parent, then we add all the nodes to the final\n // results)\n for (let i = from; i < to; i++) {\n topLevelResultCols.push(currentlyIterating[i]);\n }\n return;\n }\n // the parent differs from the previous node, so we create a group from the previous node\n // and add all to the result array, except the current node.\n const newGroup = this.createColumnGroup(previousNodeParent, groupInstanceIdCreator, oldColumnsMapped, pinned);\n for (let i = from; i < to; i++) {\n newGroup.addChild(currentlyIterating[i]);\n }\n groupsOrColsAtCurrentLevel.push(newGroup);\n };\n for (let i = 1; i < currentlyIterating.length; i++) {\n const thisNode = currentlyIterating[i];\n const thisNodeProvided = thisNode instanceof ColumnGroup ? thisNode.getProvidedColumnGroup() : thisNode;\n const thisNodeParent = thisNodeProvided.getOriginalParent();\n const previousNode = currentlyIterating[lastGroupedColIdx];\n const previousNodeProvided = previousNode instanceof ColumnGroup ? previousNode.getProvidedColumnGroup() : previousNode;\n const previousNodeParent = previousNodeProvided.getOriginalParent();\n if (thisNodeParent !== previousNodeParent) {\n createGroupToIndex(i);\n }\n }\n if (lastGroupedColIdx < currentlyIterating.length) {\n createGroupToIndex(currentlyIterating.length);\n }\n }\n this.setupParentsIntoColumns(topLevelResultCols, null);\n return topLevelResultCols;\n }\n createColumnGroup(providedGroup, groupInstanceIdCreator, oldColumnsMapped, pinned) {\n const groupId = providedGroup.getGroupId();\n const instanceId = groupInstanceIdCreator.getInstanceIdForKey(groupId);\n const uniqueId = ColumnGroup.createUniqueId(groupId, instanceId);\n let columnGroup = oldColumnsMapped[uniqueId];\n // if the user is setting new colDefs, it is possible that the id's overlap, and we\n // would have a false match from above. so we double check we are talking about the\n // same original column group.\n if (columnGroup && columnGroup.getProvidedColumnGroup() !== providedGroup) {\n columnGroup = null;\n }\n if (exists(columnGroup)) {\n // clean out the old column group here, as we will be adding children into it again\n columnGroup.reset();\n }\n else {\n columnGroup = new ColumnGroup(providedGroup, groupId, instanceId, pinned);\n this.context.createBean(columnGroup);\n }\n return columnGroup;\n }\n // returns back a 2d map of ColumnGroup as follows: groupId -> instanceId -> ColumnGroup\n mapOldGroupsById(displayedGroups) {\n const result = {};\n const recursive = (columnsOrGroups) => {\n columnsOrGroups.forEach(columnOrGroup => {\n if (columnOrGroup instanceof ColumnGroup) {\n const columnGroup = columnOrGroup;\n result[columnOrGroup.getUniqueId()] = columnGroup;\n recursive(columnGroup.getChildren());\n }\n });\n };\n if (displayedGroups) {\n recursive(displayedGroups);\n }\n return result;\n }\n setupParentsIntoColumns(columnsOrGroups, parent) {\n columnsOrGroups.forEach(columnsOrGroup => {\n columnsOrGroup.setParent(parent);\n if (columnsOrGroup instanceof ColumnGroup) {\n const columnGroup = columnsOrGroup;\n this.setupParentsIntoColumns(columnGroup.getChildren(), columnGroup);\n }\n });\n }\n};\nDisplayedGroupCreator = __decorate([\n Bean('displayedGroupCreator')\n], DisplayedGroupCreator);\nexport { DisplayedGroupCreator };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nlet AgStackComponentsRegistry = class AgStackComponentsRegistry extends BeanStub {\n constructor() {\n super(...arguments);\n this.componentsMappedByName = {};\n }\n setupComponents(components) {\n if (components) {\n components.forEach(componentMeta => this.addComponent(componentMeta));\n }\n }\n addComponent(componentMeta) {\n // get name of the class as a string\n // insert a dash after every capital letter\n // let classEscaped = className.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n const classEscaped = componentMeta.componentName.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n // put all to upper case\n const classUpperCase = classEscaped.toUpperCase();\n // finally store\n this.componentsMappedByName[classUpperCase] = componentMeta.componentClass;\n }\n getComponentClass(htmlTag) {\n return this.componentsMappedByName[htmlTag];\n }\n};\nAgStackComponentsRegistry = __decorate([\n Bean('agStackComponentsRegistry')\n], AgStackComponentsRegistry);\nexport { AgStackComponentsRegistry };\n","// ARIA HELPER FUNCTIONS\nfunction toggleAriaAttribute(element, attribute, value) {\n if (value == null || value == '') {\n removeAriaAttribute(element, attribute);\n }\n else {\n setAriaAttribute(element, attribute, value);\n }\n}\nfunction setAriaAttribute(element, attribute, value) {\n element.setAttribute(ariaAttributeName(attribute), value.toString());\n}\nfunction removeAriaAttribute(element, attribute) {\n element.removeAttribute(ariaAttributeName(attribute));\n}\nfunction ariaAttributeName(attribute) {\n return `aria-${attribute}`;\n}\nexport function setAriaRole(element, role) {\n if (role) {\n element.setAttribute('role', role);\n }\n else {\n element.removeAttribute('role');\n }\n}\nexport function getAriaSortState(sortDirection) {\n let sort;\n if (sortDirection === 'asc') {\n sort = 'ascending';\n }\n else if (sortDirection === 'desc') {\n sort = 'descending';\n }\n else if (sortDirection === 'mixed') {\n sort = 'other';\n }\n else {\n sort = 'none';\n }\n return sort;\n}\n// ARIA ATTRIBUTE GETTERS\nexport function getAriaLevel(element) {\n return parseInt(element.getAttribute('aria-level'), 10);\n}\nexport function getAriaPosInSet(element) {\n return parseInt(element.getAttribute('aria-posinset'), 10);\n}\nexport function getAriaDescribedBy(element) {\n return element.getAttribute('aria-describedby') || '';\n}\n// ARIA ATTRIBUTE SETTERS\nexport function setAriaLabel(element, label) {\n toggleAriaAttribute(element, 'label', label);\n}\nexport function setAriaLabelledBy(element, labelledBy) {\n toggleAriaAttribute(element, 'labelledby', labelledBy);\n}\nexport function setAriaDescription(element, description) {\n toggleAriaAttribute(element, 'description', description);\n}\nexport function setAriaDescribedBy(element, describedby) {\n toggleAriaAttribute(element, 'describedby', describedby);\n}\nexport function setAriaLive(element, live) {\n toggleAriaAttribute(element, 'live', live);\n}\nexport function setAriaLevel(element, level) {\n toggleAriaAttribute(element, 'level', level);\n}\nexport function setAriaDisabled(element, disabled) {\n toggleAriaAttribute(element, 'disabled', disabled);\n}\nexport function setAriaHidden(element, hidden) {\n toggleAriaAttribute(element, 'hidden', hidden);\n}\nexport function setAriaExpanded(element, expanded) {\n setAriaAttribute(element, 'expanded', expanded);\n}\nexport function removeAriaExpanded(element) {\n removeAriaAttribute(element, 'expanded');\n}\nexport function setAriaSetSize(element, setsize) {\n setAriaAttribute(element, 'setsize', setsize);\n}\nexport function setAriaPosInSet(element, position) {\n setAriaAttribute(element, 'posinset', position);\n}\nexport function setAriaMultiSelectable(element, multiSelectable) {\n setAriaAttribute(element, 'multiselectable', multiSelectable);\n}\nexport function setAriaRowCount(element, rowCount) {\n setAriaAttribute(element, 'rowcount', rowCount);\n}\nexport function setAriaRowIndex(element, rowIndex) {\n setAriaAttribute(element, 'rowindex', rowIndex);\n}\nexport function setAriaColCount(element, colCount) {\n setAriaAttribute(element, 'colcount', colCount);\n}\nexport function setAriaColIndex(element, colIndex) {\n setAriaAttribute(element, 'colindex', colIndex);\n}\nexport function setAriaColSpan(element, colSpan) {\n setAriaAttribute(element, 'colspan', colSpan);\n}\nexport function setAriaSort(element, sort) {\n setAriaAttribute(element, 'sort', sort);\n}\nexport function removeAriaSort(element) {\n removeAriaAttribute(element, 'sort');\n}\nexport function setAriaSelected(element, selected) {\n toggleAriaAttribute(element, 'selected', selected);\n}\nexport function setAriaChecked(element, checked) {\n setAriaAttribute(element, 'checked', checked === undefined ? 'mixed' : checked);\n}\nexport function setAriaControls(controllerElement, controlledElement) {\n toggleAriaAttribute(controllerElement, 'controls', controlledElement.id);\n setAriaLabelledBy(controlledElement, controllerElement.id);\n}\nexport function getAriaCheckboxStateName(translate, state) {\n return state === undefined\n ? translate('ariaIndeterminate', 'indeterminate')\n : (state === true\n ? translate('ariaChecked', 'checked')\n : translate('ariaUnchecked', 'unchecked'));\n}\n","/**\n * These variables are lazy loaded, as otherwise they try and get initialised when we are loading\n * unit tests and we don't have references to window or document in the unit tests\n */\nlet isSafari;\nlet safariVersion;\nlet isChrome;\nlet isFirefox;\nlet isMacOs;\nlet isIOS;\nlet invisibleScrollbar;\nlet browserScrollbarWidth;\nexport function isBrowserSafari() {\n if (isSafari === undefined) {\n isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n }\n return isSafari;\n}\nexport function getSafariVersion() {\n if (safariVersion === undefined) {\n if (isBrowserSafari()) {\n const versionMatch = navigator.userAgent.match(/version\\/(\\d+)/i);\n if (versionMatch) {\n safariVersion = versionMatch[1] != null ? parseFloat(versionMatch[1]) : 0;\n }\n }\n else {\n safariVersion = 0;\n }\n }\n return safariVersion;\n}\n/**\n * Returns true for Chrome and also for Edge (Chromium)\n */\nexport function isBrowserChrome() {\n if (isChrome === undefined) {\n const win = window;\n isChrome = (!!win.chrome && (!!win.chrome.webstore || !!win.chrome.runtime)) ||\n (/Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor));\n }\n return isChrome;\n}\nexport function isBrowserFirefox() {\n if (isFirefox === undefined) {\n isFirefox = /(firefox)/i.test(navigator.userAgent);\n }\n return isFirefox;\n}\nexport function isMacOsUserAgent() {\n if (isMacOs === undefined) {\n isMacOs = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);\n }\n return isMacOs;\n}\nexport function isIOSUserAgent() {\n if (isIOS === undefined) {\n isIOS = (/iPad|iPhone|iPod/.test(navigator.platform) ||\n // eslint-disable-next-line\n (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1));\n }\n return isIOS;\n}\nexport function browserSupportsPreventScroll() {\n // all browsers except safari support focus({ preventScroll: true }).\n // this feature was added on Safari 15+\n return !isBrowserSafari() || getSafariVersion() >= 15;\n}\nexport function getTabIndex(el) {\n if (!el) {\n return null;\n }\n const numberTabIndex = el.tabIndex;\n const tabIndex = el.getAttribute('tabIndex');\n if (numberTabIndex === -1 && (tabIndex === null || (tabIndex === '' && !isBrowserFirefox()))) {\n return null;\n }\n return numberTabIndex.toString();\n}\nexport function getMaxDivHeight() {\n if (!document.body) {\n return -1;\n }\n let res = 1000000;\n // FF reports the height back but still renders blank after ~6M px\n const testUpTo = navigator.userAgent.toLowerCase().match(/firefox/) ? 6000000 : 1000000000;\n const div = document.createElement('div');\n document.body.appendChild(div);\n while (true) {\n const test = res * 2;\n div.style.height = test + 'px';\n if (test > testUpTo || div.clientHeight !== test) {\n break;\n }\n else {\n res = test;\n }\n }\n document.body.removeChild(div);\n return res;\n}\nexport function getBodyWidth() {\n var _a, _b, _c;\n return (_b = (_a = document.body) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : (window.innerHeight || ((_c = document.documentElement) === null || _c === void 0 ? void 0 : _c.clientWidth) || -1);\n}\nexport function getBodyHeight() {\n var _a, _b, _c;\n return (_b = (_a = document.body) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : (window.innerHeight || ((_c = document.documentElement) === null || _c === void 0 ? void 0 : _c.clientHeight) || -1);\n}\nexport function getScrollbarWidth() {\n if (browserScrollbarWidth == null) {\n initScrollbarWidthAndVisibility();\n }\n return browserScrollbarWidth;\n}\nfunction initScrollbarWidthAndVisibility() {\n const body = document.body;\n const div = document.createElement('div');\n div.style.width = div.style.height = '100px';\n div.style.opacity = '0';\n div.style.overflow = 'scroll';\n div.style.msOverflowStyle = 'scrollbar'; // needed for WinJS apps\n div.style.position = 'absolute';\n body.appendChild(div);\n let width = div.offsetWidth - div.clientWidth;\n // if width is 0 and client width is 0, means the DOM isn't ready\n if (width === 0 && div.clientWidth === 0) {\n width = null;\n }\n // remove div\n if (div.parentNode) {\n div.parentNode.removeChild(div);\n }\n if (width != null) {\n browserScrollbarWidth = width;\n invisibleScrollbar = width === 0;\n }\n}\nexport function isInvisibleScrollbar() {\n if (invisibleScrollbar == null) {\n initScrollbarWidthAndVisibility();\n }\n return invisibleScrollbar;\n}\n","export function padStartWidthZeros(value, totalStringSize) {\n return value.toString().padStart(totalStringSize, '0');\n}\nexport function createArrayOfNumbers(first, last) {\n const result = [];\n for (let i = first; i <= last; i++) {\n result.push(i);\n }\n return result;\n}\nexport function cleanNumber(value) {\n if (typeof value === 'string') {\n value = parseInt(value, 10);\n }\n if (typeof value === 'number') {\n return Math.floor(value);\n }\n return null;\n}\nexport function decToHex(number, bytes) {\n let hex = '';\n for (let i = 0; i < bytes; i++) {\n hex += String.fromCharCode(number & 0xff);\n number >>>= 8;\n }\n return hex;\n}\nexport function formatNumberTwoDecimalPlacesAndCommas(value, thousandSeparator, decimalSeparator) {\n if (typeof value !== 'number') {\n return '';\n }\n return formatNumberCommas(Math.round(value * 100) / 100, thousandSeparator, decimalSeparator);\n}\n/**\n * the native method number.toLocaleString(undefined, {minimumFractionDigits: 0})\n * puts in decimal places in IE, so we use this method instead\n * from: http://blog.tompawlak.org/number-currency-formatting-javascript\n * @param {number} value\n * @returns {string}\n */\nexport function formatNumberCommas(value, thousandSeparator, decimalSeparator) {\n if (typeof value !== 'number') {\n return '';\n }\n return value.toString().replace('.', decimalSeparator).replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, `$1${thousandSeparator}`);\n}\nexport function sum(values) {\n return values == null ? null : values.reduce((total, value) => total + value, 0);\n}\nexport function zeroOrGreater(value, defaultValue) {\n if (value >= 0) {\n return value;\n }\n // zero gets returned if number is missing or the wrong type\n return defaultValue;\n}\nexport function oneOrGreater(value, defaultValue) {\n const valueNumber = parseInt(value, 10);\n if (!isNaN(valueNumber) && isFinite(valueNumber) && valueNumber > 0) {\n return valueNumber;\n }\n return defaultValue;\n}\n","import { padStartWidthZeros } from './number.mjs';\n/**\n * Serialises a Date to a string of format `yyyy-MM-dd HH:mm:ss`.\n * An alternative separator can be provided to be used instead of hyphens.\n * @param date The date to serialise\n * @param includeTime Whether to include the time in the serialised string\n * @param separator The separator to use between date parts\n */\nexport function serialiseDate(date, includeTime = true, separator = '-') {\n if (!date) {\n return null;\n }\n let serialised = [date.getFullYear(), date.getMonth() + 1, date.getDate()].map(part => padStartWidthZeros(part, 2)).join(separator);\n if (includeTime) {\n serialised += ' ' + [date.getHours(), date.getMinutes(), date.getSeconds()].map(part => padStartWidthZeros(part, 2)).join(':');\n }\n return serialised;\n}\nconst calculateOrdinal = (value) => {\n if (value > 3 && value < 21) {\n return 'th';\n }\n const remainder = value % 10;\n switch (remainder) {\n case 1: return \"st\";\n case 2: return \"nd\";\n case 3: return \"rd\";\n }\n return 'th';\n};\n/**\n * Serialises a Date to a string of format the defined format, does not include time.\n * @param date The date to serialise\n * @param format The string to format the date to, defaults to YYYY-MM-DD\n */\nexport function dateToFormattedString(date, format = 'YYYY-MM-DD') {\n const fullYear = padStartWidthZeros(date.getFullYear(), 4);\n const months = [\n 'January', 'February', 'March', 'April', 'May', 'June',\n 'July', 'August', 'September', 'October', 'November', 'December',\n ];\n const days = [\n 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',\n ];\n const replace = {\n YYYY: () => fullYear.slice(fullYear.length - 4, fullYear.length),\n YY: () => fullYear.slice(fullYear.length - 2, fullYear.length),\n Y: () => `${date.getFullYear()}`,\n MMMM: () => months[date.getMonth()],\n MMM: () => months[date.getMonth()].slice(0, 3),\n MM: () => padStartWidthZeros(date.getMonth() + 1, 2),\n Mo: () => `${date.getMonth() + 1}${calculateOrdinal(date.getMonth() + 1)}`,\n M: () => `${date.getMonth() + 1}`,\n Do: () => `${date.getDate()}${calculateOrdinal(date.getDate())}`,\n DD: () => padStartWidthZeros(date.getDate(), 2),\n D: () => `${date.getDate()}`,\n dddd: () => days[date.getDay()],\n ddd: () => days[date.getDay()].slice(0, 3),\n dd: () => days[date.getDay()].slice(0, 2),\n do: () => `${date.getDay()}${calculateOrdinal(date.getDay())}`,\n d: () => `${date.getDay()}`,\n };\n const regexp = new RegExp(Object.keys(replace).join('|'), 'g');\n return format.replace(regexp, (match) => {\n if (match in replace) {\n return replace[match]();\n }\n return match;\n });\n}\n/**\n * Parses a date and time from a string in the format `yyyy-MM-dd HH:mm:ss`\n */\nexport function parseDateTimeFromString(value) {\n if (!value) {\n return null;\n }\n const [dateStr, timeStr] = value.split(' ');\n if (!dateStr) {\n return null;\n }\n const fields = dateStr.split('-').map(f => parseInt(f, 10));\n if (fields.filter(f => !isNaN(f)).length !== 3) {\n return null;\n }\n const [year, month, day] = fields;\n const date = new Date(year, month - 1, day);\n if (date.getFullYear() !== year ||\n date.getMonth() !== month - 1 ||\n date.getDate() !== day) {\n // date was not parsed as expected so must have been invalid\n return null;\n }\n if (!timeStr || timeStr === '00:00:00') {\n return date;\n }\n const [hours, minutes, seconds] = timeStr.split(':').map(part => parseInt(part, 10));\n if (hours >= 0 && hours < 24) {\n date.setHours(hours);\n }\n if (minutes >= 0 && minutes < 60) {\n date.setMinutes(minutes);\n }\n if (seconds >= 0 && seconds < 60) {\n date.setSeconds(seconds);\n }\n return date;\n}\n","import { browserSupportsPreventScroll, isBrowserChrome, isBrowserSafari } from './browser.mjs';\nimport { exists } from './generic.mjs';\nimport { setAriaHidden } from './aria.mjs';\nimport { camelCaseToHyphenated } from './string.mjs';\nlet rtlNegativeScroll;\n/**\n * This method adds a class to an element and remove that class from all siblings.\n * Useful for toggling state.\n * @param {HTMLElement} element The element to receive the class\n * @param {string} elementClass The class to be assigned to the element\n * @param {boolean} otherElementClass The class to be assigned to siblings of the element, but not the element itself\n */\nexport function radioCssClass(element, elementClass, otherElementClass) {\n const parent = element.parentElement;\n let sibling = parent && parent.firstChild;\n while (sibling) {\n if (elementClass) {\n sibling.classList.toggle(elementClass, sibling === element);\n }\n if (otherElementClass) {\n sibling.classList.toggle(otherElementClass, sibling !== element);\n }\n sibling = sibling.nextSibling;\n }\n}\nexport const FOCUSABLE_SELECTOR = '[tabindex], input, select, button, textarea, [href]';\nexport const FOCUSABLE_EXCLUDE = '.ag-hidden, .ag-hidden *, [disabled], .ag-disabled:not(.ag-button), .ag-disabled *.mjs';\nexport function isFocusableFormField(element) {\n const matches = Element.prototype.matches || Element.prototype.msMatchesSelector;\n const inputSelector = 'input, select, button, textarea';\n const isFocusable = matches.call(element, inputSelector);\n const isNotFocusable = matches.call(element, FOCUSABLE_EXCLUDE);\n const isElementVisible = isVisible(element);\n const focusable = isFocusable && !isNotFocusable && isElementVisible;\n return focusable;\n}\nexport function setDisplayed(element, displayed, options = {}) {\n const { skipAriaHidden } = options;\n element.classList.toggle('ag-hidden', !displayed);\n if (!skipAriaHidden) {\n setAriaHidden(element, !displayed);\n }\n}\nexport function setVisible(element, visible, options = {}) {\n const { skipAriaHidden } = options;\n element.classList.toggle('ag-invisible', !visible);\n if (!skipAriaHidden) {\n setAriaHidden(element, !visible);\n }\n}\nexport function setDisabled(element, disabled) {\n const attributeName = 'disabled';\n const addOrRemoveDisabledAttribute = disabled ?\n (e) => e.setAttribute(attributeName, '') :\n (e) => e.removeAttribute(attributeName);\n addOrRemoveDisabledAttribute(element);\n nodeListForEach(element.querySelectorAll('input'), input => addOrRemoveDisabledAttribute(input));\n}\nexport function isElementChildOfClass(element, cls, maxNest) {\n let counter = 0;\n while (element) {\n if (element.classList.contains(cls)) {\n return true;\n }\n element = element.parentElement;\n if (typeof maxNest == 'number') {\n if (++counter > maxNest) {\n break;\n }\n }\n else if (element === maxNest) {\n break;\n }\n }\n return false;\n}\n// returns back sizes as doubles instead of strings. similar to\n// getBoundingClientRect, however getBoundingClientRect does not:\n// a) work with fractions (eg browser is zooming)\n// b) has CSS transitions applied (eg CSS scale, browser zoom), which we don't want, we want the un-transitioned values\nexport function getElementSize(el) {\n const { height, width, borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth, paddingTop, paddingRight, paddingBottom, paddingLeft, marginTop, marginRight, marginBottom, marginLeft, boxSizing } = window.getComputedStyle(el);\n return {\n height: parseFloat(height),\n width: parseFloat(width),\n borderTopWidth: parseFloat(borderTopWidth),\n borderRightWidth: parseFloat(borderRightWidth),\n borderBottomWidth: parseFloat(borderBottomWidth),\n borderLeftWidth: parseFloat(borderLeftWidth),\n paddingTop: parseFloat(paddingTop),\n paddingRight: parseFloat(paddingRight),\n paddingBottom: parseFloat(paddingBottom),\n paddingLeft: parseFloat(paddingLeft),\n marginTop: parseFloat(marginTop),\n marginRight: parseFloat(marginRight),\n marginBottom: parseFloat(marginBottom),\n marginLeft: parseFloat(marginLeft),\n boxSizing\n };\n}\nexport function getInnerHeight(el) {\n const size = getElementSize(el);\n if (size.boxSizing === 'border-box') {\n return size.height - size.paddingTop - size.paddingBottom;\n }\n return size.height;\n}\nexport function getInnerWidth(el) {\n const size = getElementSize(el);\n if (size.boxSizing === 'border-box') {\n return size.width - size.paddingLeft - size.paddingRight;\n }\n return size.width;\n}\nexport function getAbsoluteHeight(el) {\n const size = getElementSize(el);\n const marginRight = size.marginBottom + size.marginTop;\n return Math.ceil(el.offsetHeight + marginRight);\n}\nexport function getAbsoluteWidth(el) {\n const size = getElementSize(el);\n const marginWidth = size.marginLeft + size.marginRight;\n return Math.ceil(el.offsetWidth + marginWidth);\n}\nexport function getElementRectWithOffset(el) {\n const offsetElementRect = el.getBoundingClientRect();\n const { borderTopWidth, borderLeftWidth, borderRightWidth, borderBottomWidth } = getElementSize(el);\n return {\n top: offsetElementRect.top + (borderTopWidth || 0),\n left: offsetElementRect.left + (borderLeftWidth || 0),\n right: offsetElementRect.right + (borderRightWidth || 0),\n bottom: offsetElementRect.bottom + (borderBottomWidth || 0),\n };\n}\nexport function isRtlNegativeScroll() {\n if (typeof rtlNegativeScroll === \"boolean\") {\n return rtlNegativeScroll;\n }\n const template = document.createElement('div');\n template.style.direction = 'rtl';\n template.style.width = '1px';\n template.style.height = '1px';\n template.style.position = 'fixed';\n template.style.top = '0px';\n template.style.overflow = 'hidden';\n template.dir = 'rtl';\n template.innerHTML = /* html */\n `
\n \n \n
`;\n document.body.appendChild(template);\n template.scrollLeft = 1;\n rtlNegativeScroll = Math.floor(template.scrollLeft) === 0;\n document.body.removeChild(template);\n return rtlNegativeScroll;\n}\nexport function getScrollLeft(element, rtl) {\n let scrollLeft = element.scrollLeft;\n if (rtl) {\n // Absolute value - for FF that reports RTL scrolls in negative numbers\n scrollLeft = Math.abs(scrollLeft);\n if (isBrowserChrome() && !isRtlNegativeScroll()) {\n scrollLeft = element.scrollWidth - element.clientWidth - scrollLeft;\n }\n }\n return scrollLeft;\n}\nexport function setScrollLeft(element, value, rtl) {\n if (rtl) {\n // Chrome and Safari when doing RTL have the END position of the scroll as zero, not the start\n if (isRtlNegativeScroll()) {\n value *= -1;\n }\n else if (isBrowserSafari() || isBrowserChrome()) {\n value = element.scrollWidth - element.clientWidth - value;\n }\n }\n element.scrollLeft = value;\n}\nexport function clearElement(el) {\n while (el && el.firstChild) {\n el.removeChild(el.firstChild);\n }\n}\n/** @deprecated */\nexport function removeElement(parent, cssSelector) {\n removeFromParent(parent.querySelector(cssSelector));\n}\nexport function removeFromParent(node) {\n if (node && node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\nexport function isVisible(element) {\n return element.offsetParent !== null;\n}\n/**\n * Loads the template and returns it as an element. makes up for no simple way in\n * the dom api to load html directly, eg we cannot do this: document.createElement(template)\n * @param {string} template\n * @returns {HTMLElement}\n */\nexport function loadTemplate(template) {\n const tempDiv = document.createElement('div');\n tempDiv.innerHTML = (template || '').trim();\n return tempDiv.firstChild;\n}\nexport function appendHtml(eContainer, htmlTemplate) {\n if (eContainer.lastChild) {\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML\n // we put the items at the start, so new items appear underneath old items,\n // so when expanding/collapsing groups, the new rows don't go on top of the\n // rows below that are moving our of the way\n eContainer.insertAdjacentHTML('afterbegin', htmlTemplate);\n }\n else {\n eContainer.innerHTML = htmlTemplate;\n }\n}\n/** @deprecated */\nexport function getElementAttribute(element, attributeName) {\n if (element.attributes && element.attributes[attributeName]) {\n const attribute = element.attributes[attributeName];\n return attribute.value;\n }\n return null;\n}\nexport function offsetHeight(element) {\n return element && element.clientHeight ? element.clientHeight : 0;\n}\nexport function offsetWidth(element) {\n return element && element.clientWidth ? element.clientWidth : 0;\n}\nexport function ensureDomOrder(eContainer, eChild, eChildBefore) {\n // if already in right order, do nothing\n if (eChildBefore && eChildBefore.nextSibling === eChild) {\n return;\n }\n const focusedEl = document.activeElement;\n const eChildHasFocus = eChild.contains(focusedEl);\n if (eChildBefore) {\n if (eChildBefore.nextSibling) {\n // insert between the eRowBefore and the row after it\n eContainer.insertBefore(eChild, eChildBefore.nextSibling);\n }\n else {\n // if nextSibling is missing, means other row is at end, so just append new row at the end\n eContainer.appendChild(eChild);\n }\n }\n else {\n // otherwise put at start\n if (eContainer.firstChild && eContainer.firstChild !== eChild) {\n // insert it at the first location\n eContainer.insertAdjacentElement('afterbegin', eChild);\n }\n }\n if (eChildHasFocus && focusedEl && browserSupportsPreventScroll()) {\n focusedEl.focus({ preventScroll: true });\n }\n}\nexport function setDomChildOrder(eContainer, orderedChildren) {\n for (let i = 0; i < orderedChildren.length; i++) {\n const correctCellAtIndex = orderedChildren[i];\n const actualCellAtIndex = eContainer.children[i];\n if (actualCellAtIndex !== correctCellAtIndex) {\n eContainer.insertBefore(correctCellAtIndex, actualCellAtIndex);\n }\n }\n}\nexport function insertWithDomOrder(eContainer, eToInsert, eChildBefore) {\n if (eChildBefore) {\n // if previous element exists, just slot in after the previous element\n eChildBefore.insertAdjacentElement('afterend', eToInsert);\n }\n else {\n if (eContainer.firstChild) {\n // insert it at the first location\n eContainer.insertAdjacentElement('afterbegin', eToInsert);\n }\n else {\n // otherwise eContainer is empty, so just append it\n eContainer.appendChild(eToInsert);\n }\n }\n}\n/** @deprecated */\nexport function prependDC(parent, documentFragment) {\n if (exists(parent.firstChild)) {\n parent.insertBefore(documentFragment, parent.firstChild);\n }\n else {\n parent.appendChild(documentFragment);\n }\n}\nexport function addStylesToElement(eElement, styles) {\n if (!styles) {\n return;\n }\n for (const [key, value] of Object.entries(styles)) {\n if (!key || !key.length || value == null) {\n continue;\n }\n // changes the key from camelCase into a hyphenated-string\n const parsedKey = camelCaseToHyphenated(key);\n const valueAsString = value.toString();\n const parsedValue = valueAsString.replace(/\\s*!important/g, '');\n const priority = parsedValue.length != valueAsString.length ? 'important' : undefined;\n eElement.style.setProperty(parsedKey, parsedValue, priority);\n }\n}\nexport function isHorizontalScrollShowing(element) {\n return element.clientWidth < element.scrollWidth;\n}\nexport function isVerticalScrollShowing(element) {\n return element.clientHeight < element.scrollHeight;\n}\nexport function setElementWidth(element, width) {\n if (width === 'flex') {\n element.style.removeProperty('width');\n element.style.removeProperty('minWidth');\n element.style.removeProperty('maxWidth');\n element.style.flex = '1 1 auto';\n }\n else {\n setFixedWidth(element, width);\n }\n}\nexport function setFixedWidth(element, width) {\n width = formatSize(width);\n element.style.width = width.toString();\n element.style.maxWidth = width.toString();\n element.style.minWidth = width.toString();\n}\nexport function setElementHeight(element, height) {\n if (height === 'flex') {\n element.style.removeProperty('height');\n element.style.removeProperty('minHeight');\n element.style.removeProperty('maxHeight');\n element.style.flex = '1 1 auto';\n }\n else {\n setFixedHeight(element, height);\n }\n}\nexport function setFixedHeight(element, height) {\n height = formatSize(height);\n element.style.height = height.toString();\n element.style.maxHeight = height.toString();\n element.style.minHeight = height.toString();\n}\nexport function formatSize(size) {\n if (typeof size === 'number') {\n return `${size}px`;\n }\n return size;\n}\nexport function isNodeOrElement(o) {\n return o instanceof Node || o instanceof HTMLElement;\n}\n/**\n * Makes a copy of a node list into a list\n * @param {NodeList} nodeList\n * @returns {Node[]}\n */\nexport function copyNodeList(nodeList) {\n if (nodeList == null) {\n return [];\n }\n const result = [];\n nodeListForEach(nodeList, node => result.push(node));\n return result;\n}\nexport function iterateNamedNodeMap(map, callback) {\n if (!map) {\n return;\n }\n for (let i = 0; i < map.length; i++) {\n const attr = map[i];\n callback(attr.name, attr.value);\n }\n}\nexport function addOrRemoveAttribute(element, name, value) {\n if (value == null) {\n element.removeAttribute(name);\n }\n else {\n element.setAttribute(name, value.toString());\n }\n}\nexport function nodeListForEach(nodeList, action) {\n if (nodeList == null) {\n return;\n }\n for (let i = 0; i < nodeList.length; i++) {\n action(nodeList[i]);\n }\n}\n/**\n * cell renderers are used in a few places. they bind to dom slightly differently to other cell renders as they\n * can return back strings (instead of html element) in the getGui() method. common code placed here to handle that.\n * @param {AgPromise} cellRendererPromise\n * @param {HTMLElement} eTarget\n */\nexport function bindCellRendererToHtmlElement(cellRendererPromise, eTarget) {\n cellRendererPromise.then(cellRenderer => {\n const gui = cellRenderer.getGui();\n if (gui != null) {\n if (typeof gui === 'object') {\n eTarget.appendChild(gui);\n }\n else {\n eTarget.innerHTML = gui;\n }\n }\n });\n}\n","import { loadTemplate, isNodeOrElement } from './dom.mjs';\nimport { setAriaRole } from './aria.mjs';\n//\n// IMPORTANT NOTE!\n//\n// If you change the list below, copy/paste the new content into the docs page javascript-grid-icons\n//\nexport const iconNameClassMap = {\n // header column group shown when expanded (click to contract)\n columnGroupOpened: 'expanded',\n // header column group shown when contracted (click to expand)\n columnGroupClosed: 'contracted',\n // tool panel column group contracted (click to expand)\n columnSelectClosed: 'tree-closed',\n // tool panel column group expanded (click to contract)\n columnSelectOpen: 'tree-open',\n // column tool panel header expand/collapse all button, shown when some children are expanded and\n // others are collapsed\n columnSelectIndeterminate: 'tree-indeterminate',\n // shown on ghost icon while dragging column to the side of the grid to pin\n columnMovePin: 'pin',\n // shown on ghost icon while dragging over part of the page that is not a drop zone\n columnMoveHide: 'eye-slash',\n // shown on ghost icon while dragging columns to reorder\n columnMoveMove: 'arrows',\n // animating icon shown when dragging a column to the right of the grid causes horizontal scrolling\n columnMoveLeft: 'left',\n // animating icon shown when dragging a column to the left of the grid causes horizontal scrolling\n columnMoveRight: 'right',\n // shown on ghost icon while dragging over Row Groups drop zone\n columnMoveGroup: 'group',\n // shown on ghost icon while dragging over Values drop zone\n columnMoveValue: 'aggregation',\n // shown on ghost icon while dragging over pivot drop zone\n columnMovePivot: 'pivot',\n // shown on ghost icon while dragging over drop zone that doesn't support it, e.g.\n // string column over aggregation drop zone\n dropNotAllowed: 'not-allowed',\n // shown on row group when contracted (click to expand)\n groupContracted: 'tree-closed',\n // shown on row group when expanded (click to contract)\n groupExpanded: 'tree-open',\n // set filter tree list group contracted (click to expand)\n setFilterGroupClosed: 'tree-closed',\n // set filter tree list group expanded (click to contract)\n setFilterGroupOpen: 'tree-open',\n // set filter tree list expand/collapse all button, shown when some children are expanded and\n // others are collapsed\n setFilterGroupIndeterminate: 'tree-indeterminate',\n // context menu chart item\n chart: 'chart',\n // chart window title bar\n close: 'cross',\n // X (remove) on column 'pill' after adding it to a drop zone list\n cancel: 'cancel',\n // indicates the currently active pin state in the \"Pin column\" sub-menu of the column menu\n check: 'tick',\n // \"go to first\" button in pagination controls\n first: 'first',\n // \"go to previous\" button in pagination controls\n previous: 'previous',\n // \"go to next\" button in pagination controls\n next: 'next',\n // \"go to last\" button in pagination controls\n last: 'last',\n // shown on top right of chart when chart is linked to range data (click to unlink)\n linked: 'linked',\n // shown on top right of chart when chart is not linked to range data (click to link)\n unlinked: 'unlinked',\n // \"Choose colour\" button on chart settings tab\n colorPicker: 'color-picker',\n // rotating spinner shown by the loading cell renderer\n groupLoading: 'loading',\n // button to launch enterprise column menu\n menu: 'menu',\n // filter tool panel tab\n filter: 'filter',\n // column tool panel tab\n columns: 'columns',\n // button in chart regular size window title bar (click to maximise)\n maximize: 'maximize',\n // button in chart maximised window title bar (click to make regular size)\n minimize: 'minimize',\n // \"Pin column\" item in column header menu\n menuPin: 'pin',\n // \"Value aggregation\" column menu item (shown on numeric columns when grouping is active)\"\n menuValue: 'aggregation',\n // \"Group by {column-name}\" item in column header menu\n menuAddRowGroup: 'group',\n // \"Un-Group by {column-name}\" item in column header menu\n menuRemoveRowGroup: 'group',\n // context menu copy item\n clipboardCopy: 'copy',\n // context menu cut item\n clipboardCut: 'cut',\n // context menu paste item\n clipboardPaste: 'paste',\n // identifies the pivot drop zone\n pivotPanel: 'pivot',\n // \"Row groups\" drop zone in column tool panel\n rowGroupPanel: 'group',\n // columns tool panel Values drop zone\n valuePanel: 'aggregation',\n // drag handle used to pick up draggable columns\n columnDrag: 'grip',\n // drag handle used to pick up draggable rows\n rowDrag: 'grip',\n // context menu export item\n save: 'save',\n // csv export\n csvExport: 'csv',\n // excel export,\n excelExport: 'excel',\n // icon on dropdown editors\n smallDown: 'small-down',\n // version of small-right used in RTL mode\n smallLeft: 'small-left',\n // separater between column 'pills' when you add multiple columns to the header drop zone\n smallRight: 'small-right',\n smallUp: 'small-up',\n // show on column header when column is sorted ascending\n sortAscending: 'asc',\n // show on column header when column is sorted descending\n sortDescending: 'desc',\n // show on column header when column has no sort, only when enabled with gridOptions.unSortIcon=true\n sortUnSort: 'none'\n};\n/**\n * If icon provided, use this (either a string, or a function callback).\n * if not, then use the default icon from the theme\n * @param {string} iconName\n * @param {GridOptionsService} gridOptionsService\n * @param {Column | null} [column]\n * @returns {Element}\n */\nexport function createIcon(iconName, gridOptionsService, column) {\n const iconContents = createIconNoSpan(iconName, gridOptionsService, column);\n if (iconContents) {\n const { className } = iconContents;\n if ((typeof className === 'string' && className.indexOf('ag-icon') > -1) ||\n (typeof className === 'object' && className['ag-icon'])) {\n return iconContents;\n }\n }\n const eResult = document.createElement('span');\n eResult.appendChild(iconContents);\n return eResult;\n}\nexport function createIconNoSpan(iconName, gridOptionsService, column, forceCreate) {\n let userProvidedIcon = null;\n // check col for icon first\n const icons = column && column.getColDef().icons;\n if (icons) {\n userProvidedIcon = icons[iconName];\n }\n // if not in col, try grid options\n if (gridOptionsService && !userProvidedIcon) {\n const optionsIcons = gridOptionsService.get('icons');\n if (optionsIcons) {\n userProvidedIcon = optionsIcons[iconName];\n }\n }\n // now if user provided, use it\n if (userProvidedIcon) {\n let rendererResult;\n if (typeof userProvidedIcon === 'function') {\n rendererResult = userProvidedIcon();\n }\n else if (typeof userProvidedIcon === 'string') {\n rendererResult = userProvidedIcon;\n }\n else {\n throw new Error('icon from grid options needs to be a string or a function');\n }\n if (typeof rendererResult === 'string') {\n return loadTemplate(rendererResult);\n }\n if (isNodeOrElement(rendererResult)) {\n return rendererResult;\n }\n console.warn('AG Grid: iconRenderer should return back a string or a dom object');\n }\n else {\n const span = document.createElement('span');\n let cssClass = iconNameClassMap[iconName];\n if (!cssClass) {\n if (!forceCreate) {\n console.warn(`AG Grid: Did not find icon ${iconName}`);\n cssClass = '';\n }\n else {\n cssClass = iconName;\n }\n }\n span.setAttribute('class', `ag-icon ag-icon-${cssClass}`);\n span.setAttribute('unselectable', 'on');\n setAriaRole(span, 'presentation');\n return span;\n }\n}\n","export class KeyCode {\n}\nKeyCode.BACKSPACE = 'Backspace';\nKeyCode.TAB = 'Tab';\nKeyCode.ENTER = 'Enter';\nKeyCode.ESCAPE = 'Escape';\nKeyCode.SPACE = ' ';\nKeyCode.LEFT = 'ArrowLeft';\nKeyCode.UP = 'ArrowUp';\nKeyCode.RIGHT = 'ArrowRight';\nKeyCode.DOWN = 'ArrowDown';\nKeyCode.DELETE = 'Delete';\nKeyCode.F2 = 'F2';\nKeyCode.PAGE_UP = 'PageUp';\nKeyCode.PAGE_DOWN = 'PageDown';\nKeyCode.PAGE_HOME = 'Home';\nKeyCode.PAGE_END = 'End';\n// these should be used with `event.code` instead of `event.key`\n// as `event.key` changes when non-latin keyboards are used\nKeyCode.A = 'KeyA';\nKeyCode.C = 'KeyC';\nKeyCode.D = 'KeyD';\nKeyCode.V = 'KeyV';\nKeyCode.X = 'KeyX';\nKeyCode.Y = 'KeyY';\nKeyCode.Z = 'KeyZ';\n","import { KeyCode } from '../constants/keyCode.mjs';\nimport { isMacOsUserAgent } from './browser.mjs';\nimport { exists } from './generic.mjs';\nconst A_KEYCODE = 65;\nconst C_KEYCODE = 67;\nconst V_KEYCODE = 86;\nconst D_KEYCODE = 68;\nconst Z_KEYCODE = 90;\nconst Y_KEYCODE = 89;\nexport function isEventFromPrintableCharacter(event) {\n // no allowed printable chars have alt or ctrl key combinations\n if (event.altKey || event.ctrlKey || event.metaKey) {\n return false;\n }\n // if key is length 1, eg if it is 'a' for the a key, or '2' for the '2' key.\n // non-printable characters have names, eg 'Enter' or 'Backspace'.\n const printableCharacter = event.key.length === 1;\n return printableCharacter;\n}\n/**\n * Allows user to tell the grid to skip specific keyboard events\n * @param {GridOptionsService} gridOptionsService\n * @param {KeyboardEvent} keyboardEvent\n * @param {IRowNode} rowNode\n * @param {Column} column\n * @param {boolean} editing\n * @returns {boolean}\n */\nexport function isUserSuppressingKeyboardEvent(gridOptionsService, keyboardEvent, rowNode, column, editing) {\n const colDefFunc = column ? column.getColDef().suppressKeyboardEvent : undefined;\n // if no callbacks provided by user, then do nothing\n if (!colDefFunc) {\n return false;\n }\n const params = {\n event: keyboardEvent,\n editing,\n column,\n api: gridOptionsService.api,\n node: rowNode,\n data: rowNode.data,\n colDef: column.getColDef(),\n context: gridOptionsService.context,\n columnApi: gridOptionsService.columnApi\n };\n // colDef get first preference on suppressing events\n if (colDefFunc) {\n const colDefFuncResult = colDefFunc(params);\n // if colDef func suppressed, then return now, no need to call gridOption func\n if (colDefFuncResult) {\n return true;\n }\n }\n // otherwise return false, don't suppress, as colDef didn't suppress and no func on gridOptions\n return false;\n}\nexport function isUserSuppressingHeaderKeyboardEvent(gridOptionsService, keyboardEvent, headerRowIndex, column) {\n const colDef = column.getDefinition();\n const colDefFunc = colDef && colDef.suppressHeaderKeyboardEvent;\n if (!exists(colDefFunc)) {\n return false;\n }\n const params = {\n api: gridOptionsService.api,\n columnApi: gridOptionsService.columnApi,\n context: gridOptionsService.context,\n colDef: colDef,\n column,\n headerRowIndex,\n event: keyboardEvent\n };\n return !!colDefFunc(params);\n}\nexport function normaliseQwertyAzerty(keyboardEvent) {\n const { keyCode } = keyboardEvent;\n let code;\n switch (keyCode) {\n case A_KEYCODE:\n code = KeyCode.A;\n break;\n case C_KEYCODE:\n code = KeyCode.C;\n break;\n case V_KEYCODE:\n code = KeyCode.V;\n break;\n case D_KEYCODE:\n code = KeyCode.D;\n break;\n case Z_KEYCODE:\n code = KeyCode.Z;\n break;\n case Y_KEYCODE:\n code = KeyCode.Y;\n break;\n default:\n code = keyboardEvent.code;\n }\n return code;\n}\nexport function isDeleteKey(key, alwaysReturnFalseOnBackspace = false) {\n if (key === KeyCode.DELETE) {\n return true;\n }\n if (!alwaysReturnFalseOnBackspace && key === KeyCode.BACKSPACE) {\n return isMacOsUserAgent();\n }\n return false;\n}\n","/**\n * `True` if the event is close to the original event by X pixels either vertically or horizontally.\n * we only start dragging after X pixels so this allows us to know if we should start dragging yet.\n * @param {MouseEvent | TouchEvent} e1\n * @param {MouseEvent | TouchEvent} e2\n * @param {number} pixelCount\n * @returns {boolean}\n */\nexport function areEventsNear(e1, e2, pixelCount) {\n // by default, we wait 4 pixels before starting the drag\n if (pixelCount === 0) {\n return false;\n }\n const diffX = Math.abs(e1.clientX - e2.clientX);\n const diffY = Math.abs(e1.clientY - e2.clientY);\n return Math.max(diffX, diffY) <= pixelCount;\n}\n","/**\n * Gets called by: a) ClientSideNodeManager and b) GroupStage to do sorting.\n * when in ClientSideNodeManager we always have indexes (as this sorts the items the\n * user provided) but when in GroupStage, the nodes can contain filler nodes that\n * don't have order id's\n * @param {RowNode[]} rowNodes\n * @param {Object} rowNodeOrder\n *\n * @returns a boolean representing whether nodes were reordered\n */\nexport function sortRowNodesByOrder(rowNodes, rowNodeOrder) {\n if (!rowNodes) {\n return false;\n }\n const comparator = (nodeA, nodeB) => {\n const positionA = rowNodeOrder[nodeA.id];\n const positionB = rowNodeOrder[nodeB.id];\n const aHasIndex = positionA !== undefined;\n const bHasIndex = positionB !== undefined;\n const bothNodesAreUserNodes = aHasIndex && bHasIndex;\n const bothNodesAreFillerNodes = !aHasIndex && !bHasIndex;\n if (bothNodesAreUserNodes) {\n // when comparing two nodes the user has provided, they always\n // have indexes\n return positionA - positionB;\n }\n if (bothNodesAreFillerNodes) {\n // when comparing two filler nodes, we have no index to compare them\n // against, however we want this sorting to be deterministic, so that\n // the rows don't jump around as the user does delta updates. so we\n // want the same sort result. so we use the __objectId - which doesn't make sense\n // from a sorting point of view, but does give consistent behaviour between\n // calls. otherwise groups jump around as delta updates are done.\n // note: previously here we used nodeId, however this gave a strange order\n // as string ordering of numbers is wrong, so using id based on creation order\n // as least gives better looking order.\n return nodeA.__objectId - nodeB.__objectId;\n }\n if (aHasIndex) {\n return 1;\n }\n return -1;\n };\n // check if the list first needs sorting\n let rowNodeA;\n let rowNodeB;\n let atLeastOneOutOfOrder = false;\n for (let i = 0; i < rowNodes.length - 1; i++) {\n rowNodeA = rowNodes[i];\n rowNodeB = rowNodes[i + 1];\n if (comparator(rowNodeA, rowNodeB) > 0) {\n atLeastOneOutOfOrder = true;\n break;\n }\n }\n if (atLeastOneOutOfOrder) {\n rowNodes.sort(comparator);\n return true;\n }\n return false;\n}\nexport function traverseNodesWithKey(nodes, callback) {\n const keyParts = [];\n recursiveSearchNodes(nodes);\n function recursiveSearchNodes(currentNodes) {\n if (!currentNodes) {\n return;\n }\n currentNodes.forEach((node) => {\n // also checking for children for tree data\n if (node.group || node.hasChildren()) {\n keyParts.push(node.key);\n const key = keyParts.join('|');\n callback(node, key);\n recursiveSearchNodes(node.childrenAfterGroup);\n keyParts.pop();\n }\n });\n }\n}\n","export function convertToSet(list) {\n const set = new Set();\n list.forEach(x => set.add(x));\n return set;\n}\n","import * as AriaUtils from './aria.mjs';\nimport * as ArrayUtils from './array.mjs';\nimport * as BrowserUtils from './browser.mjs';\nimport * as DateUtils from './date.mjs';\nimport * as DomUtils from './dom.mjs';\nimport * as EventUtils from './event.mjs';\nimport * as FunctionUtils from './function.mjs';\nimport * as FuzzyMatchUtils from './fuzzyMatch.mjs';\nimport * as GenericUtils from './generic.mjs';\nimport * as IconUtils from './icon.mjs';\nimport * as KeyboardUtils from './keyboard.mjs';\nimport * as MapUtils from './map.mjs';\nimport * as MouseUtils from './mouse.mjs';\nimport * as NumberUtils from './number.mjs';\nimport * as ObjectUtils from './object.mjs';\nimport * as RowNodeUtils from './rowNode.mjs';\nimport * as SetUtils from './set.mjs';\nimport * as StringUtils from './string.mjs';\nconst utils = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, AriaUtils), ArrayUtils), BrowserUtils), DateUtils), DomUtils), EventUtils), FunctionUtils), FuzzyMatchUtils), GenericUtils), IconUtils), KeyboardUtils), MapUtils), MouseUtils), NumberUtils), ObjectUtils), RowNodeUtils), SetUtils), StringUtils);\nexport const _ = utils;\n","export class NumberSequence {\n constructor(initValue = 0, step = 1) {\n this.nextValue = initValue;\n this.step = step;\n }\n next() {\n const valToReturn = this.nextValue;\n this.nextValue += this.step;\n return valToReturn;\n }\n peek() {\n return this.nextValue;\n }\n skip(count) {\n this.nextValue += count;\n }\n}\n","export var AgPromiseStatus;\n(function (AgPromiseStatus) {\n AgPromiseStatus[AgPromiseStatus[\"IN_PROGRESS\"] = 0] = \"IN_PROGRESS\";\n AgPromiseStatus[AgPromiseStatus[\"RESOLVED\"] = 1] = \"RESOLVED\";\n})(AgPromiseStatus || (AgPromiseStatus = {}));\nexport class AgPromise {\n constructor(callback) {\n this.status = AgPromiseStatus.IN_PROGRESS;\n this.resolution = null;\n this.waiters = [];\n callback(value => this.onDone(value), params => this.onReject(params));\n }\n static all(promises) {\n return new AgPromise(resolve => {\n let remainingToResolve = promises.length;\n const combinedValues = new Array(remainingToResolve);\n promises.forEach((promise, index) => {\n promise.then(value => {\n combinedValues[index] = value;\n remainingToResolve--;\n if (remainingToResolve === 0) {\n resolve(combinedValues);\n }\n });\n });\n });\n }\n static resolve(value = null) {\n return new AgPromise(resolve => resolve(value));\n }\n then(func) {\n return new AgPromise(resolve => {\n if (this.status === AgPromiseStatus.RESOLVED) {\n resolve(func(this.resolution));\n }\n else {\n this.waiters.push(value => resolve(func(value)));\n }\n });\n }\n resolveNow(ifNotResolvedValue, ifResolved) {\n return this.status === AgPromiseStatus.RESOLVED ? ifResolved(this.resolution) : ifNotResolvedValue;\n }\n onDone(value) {\n this.status = AgPromiseStatus.RESOLVED;\n this.resolution = value;\n this.waiters.forEach(waiter => waiter(value));\n }\n onReject(params) {\n console.warn('TBI');\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nimport { isIOSUserAgent } from \"../utils/browser.mjs\";\nimport { doOnce } from \"../utils/function.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nvar TooltipStates;\n(function (TooltipStates) {\n TooltipStates[TooltipStates[\"NOTHING\"] = 0] = \"NOTHING\";\n TooltipStates[TooltipStates[\"WAITING_TO_SHOW\"] = 1] = \"WAITING_TO_SHOW\";\n TooltipStates[TooltipStates[\"SHOWING\"] = 2] = \"SHOWING\";\n})(TooltipStates || (TooltipStates = {}));\nvar TooltipTrigger;\n(function (TooltipTrigger) {\n TooltipTrigger[TooltipTrigger[\"HOVER\"] = 0] = \"HOVER\";\n TooltipTrigger[TooltipTrigger[\"FOCUS\"] = 1] = \"FOCUS\";\n})(TooltipTrigger || (TooltipTrigger = {}));\nexport class CustomTooltipFeature extends BeanStub {\n constructor(parentComp, tooltipShowDelayOverride, tooltipHideDelayOverride) {\n super();\n this.parentComp = parentComp;\n this.tooltipShowDelayOverride = tooltipShowDelayOverride;\n this.tooltipHideDelayOverride = tooltipHideDelayOverride;\n this.DEFAULT_SHOW_TOOLTIP_DELAY = 2000;\n this.DEFAULT_HIDE_TOOLTIP_DELAY = 10000;\n this.SHOW_QUICK_TOOLTIP_DIFF = 1000;\n this.FADE_OUT_TOOLTIP_TIMEOUT = 1000;\n this.INTERACTIVE_HIDE_DELAY = 100;\n this.interactionEnabled = false;\n this.isInteractingWithTooltip = false;\n this.state = TooltipStates.NOTHING;\n // when showing the tooltip, we need to make sure it's the most recent instance we request, as due to\n // async we could request two tooltips before the first instance returns, in which case we should\n // disregard the second instance.\n this.tooltipInstanceCount = 0;\n this.tooltipMouseTrack = false;\n }\n postConstruct() {\n if (this.gridOptionsService.is('tooltipInteraction')) {\n this.interactionEnabled = true;\n }\n this.tooltipTrigger = this.getTooltipTrigger();\n this.tooltipShowDelay = this.getTooltipDelay('show');\n this.tooltipHideDelay = this.getTooltipDelay('hide');\n this.tooltipMouseTrack = this.gridOptionsService.is('tooltipMouseTrack');\n const el = this.parentComp.getGui();\n if (this.tooltipTrigger === TooltipTrigger.HOVER) {\n this.addManagedListener(el, 'mouseenter', this.onMouseEnter.bind(this));\n this.addManagedListener(el, 'mouseleave', this.onMouseLeave.bind(this));\n }\n if (this.tooltipTrigger === TooltipTrigger.FOCUS) {\n this.addManagedListener(el, 'focusin', this.onFocusIn.bind(this));\n this.addManagedListener(el, 'focusout', this.onFocusOut.bind(this));\n }\n this.addManagedListener(el, 'mousemove', this.onMouseMove.bind(this));\n if (!this.interactionEnabled) {\n this.addManagedListener(el, 'mousedown', this.onMouseDown.bind(this));\n this.addManagedListener(el, 'keydown', this.onKeyDown.bind(this));\n }\n }\n getGridOptionsTooltipDelay(delayOption) {\n const delay = this.gridOptionsService.getNum(delayOption);\n if (exists(delay)) {\n if (delay < 0) {\n doOnce(() => console.warn(`AG Grid: ${delayOption} should not be lower than 0`), `${delayOption}Warn`);\n }\n return Math.max(200, delay);\n }\n return undefined;\n }\n getTooltipDelay(type) {\n var _a, _b, _c, _d;\n if (type === 'show') {\n return (_b = (_a = this.getGridOptionsTooltipDelay('tooltipShowDelay')) !== null && _a !== void 0 ? _a : this.tooltipShowDelayOverride) !== null && _b !== void 0 ? _b : this.DEFAULT_SHOW_TOOLTIP_DELAY;\n }\n else {\n return (_d = (_c = this.getGridOptionsTooltipDelay('tooltipHideDelay')) !== null && _c !== void 0 ? _c : this.tooltipHideDelayOverride) !== null && _d !== void 0 ? _d : this.DEFAULT_HIDE_TOOLTIP_DELAY;\n }\n }\n destroy() {\n // if this component gets destroyed while tooltip is showing, need to make sure\n // we don't end with no mouseLeave event resulting in zombie tooltip\n this.setToDoNothing();\n super.destroy();\n }\n getTooltipTrigger() {\n const trigger = this.gridOptionsService.get('tooltipTrigger');\n if (!trigger || trigger === 'hover') {\n return TooltipTrigger.HOVER;\n }\n return TooltipTrigger.FOCUS;\n }\n onMouseEnter(e) {\n // if `interactiveTooltipTimeoutId` is set, it means that this cell has a tooltip\n // and we are in the process of moving the cursor from the tooltip back to the cell\n // so we need to unlock this service here.\n if (this.interactionEnabled && this.interactiveTooltipTimeoutId) {\n this.unlockService();\n this.startHideTimeout();\n }\n if (isIOSUserAgent()) {\n return;\n }\n if (CustomTooltipFeature.isLocked) {\n this.showTooltipTimeoutId = window.setTimeout(() => {\n this.prepareToShowTooltip(e);\n }, this.INTERACTIVE_HIDE_DELAY);\n }\n else {\n this.prepareToShowTooltip(e);\n }\n }\n onMouseMove(e) {\n // there is a delay from the time we mouseOver a component and the time the\n // tooltip is displayed, so we need to track mousemove to be able to correctly\n // position the tooltip when showTooltip is called.\n if (this.lastMouseEvent) {\n this.lastMouseEvent = e;\n }\n if (this.tooltipMouseTrack &&\n this.state === TooltipStates.SHOWING &&\n this.tooltipComp) {\n this.positionTooltip();\n }\n }\n onMouseDown() {\n this.setToDoNothing();\n }\n onMouseLeave() {\n // if interaction is enabled, we need to verify if the user is moving\n // the cursor from the cell onto the tooltip, so we lock the service \n // for 100ms to prevent other tooltips from being created while this is happening.\n if (this.interactionEnabled) {\n this.lockService();\n }\n else {\n this.setToDoNothing();\n }\n }\n onFocusIn() {\n this.prepareToShowTooltip();\n }\n onFocusOut(e) {\n var _a;\n const relatedTarget = e.relatedTarget;\n const parentCompGui = this.parentComp.getGui();\n const tooltipGui = (_a = this.tooltipComp) === null || _a === void 0 ? void 0 : _a.getGui();\n if (this.isInteractingWithTooltip ||\n parentCompGui.contains(relatedTarget) ||\n (this.interactionEnabled && (tooltipGui === null || tooltipGui === void 0 ? void 0 : tooltipGui.contains(relatedTarget)))) {\n return;\n }\n this.setToDoNothing();\n }\n onKeyDown() {\n this.setToDoNothing();\n }\n prepareToShowTooltip(mouseEvent) {\n // every mouseenter should be following by a mouseleave, however for some unknown, it's possible for\n // mouseenter to be called twice in a row, which can happen if editing the cell. this was reported\n // in https://ag-grid.atlassian.net/browse/AG-4422. to get around this, we check the state, and if\n // state is != nothing, then we know mouseenter was already received.\n if (this.state != TooltipStates.NOTHING || CustomTooltipFeature.isLocked) {\n return false;\n }\n // if we are showing the tooltip because of focus, no delay at all\n // if another tooltip was hidden very recently, we only wait 200ms to show, not the normal waiting time\n let delay = 0;\n if (mouseEvent) {\n delay = this.isLastTooltipHiddenRecently() ? 200 : this.tooltipShowDelay;\n }\n this.lastMouseEvent = mouseEvent || null;\n this.showTooltipTimeoutId = window.setTimeout(this.showTooltip.bind(this), delay);\n this.state = TooltipStates.WAITING_TO_SHOW;\n return true;\n }\n isLastTooltipHiddenRecently() {\n // return true if <1000ms since last time we hid a tooltip\n const now = new Date().getTime();\n const then = CustomTooltipFeature.lastTooltipHideTime;\n return (now - then) < this.SHOW_QUICK_TOOLTIP_DIFF;\n }\n setToDoNothing() {\n if (this.state === TooltipStates.SHOWING) {\n this.hideTooltip();\n }\n if (this.onBodyScrollEventCallback) {\n this.onBodyScrollEventCallback();\n this.onBodyScrollEventCallback = undefined;\n }\n if (this.onColumnMovedEventCallback) {\n this.onColumnMovedEventCallback();\n this.onColumnMovedEventCallback = undefined;\n }\n this.clearTimeouts();\n this.state = TooltipStates.NOTHING;\n this.lastMouseEvent = null;\n }\n showTooltip() {\n const params = Object.assign({}, this.parentComp.getTooltipParams());\n if (!exists(params.value)) {\n this.setToDoNothing();\n return;\n }\n this.state = TooltipStates.SHOWING;\n this.tooltipInstanceCount++;\n // we pass in tooltipInstanceCount so the callback knows what the count was when\n // we requested the tooltip, so if another tooltip was requested in the mean time\n // we disregard it\n const callback = this.newTooltipComponentCallback.bind(this, this.tooltipInstanceCount);\n const userDetails = this.userComponentFactory.getTooltipCompDetails(params);\n userDetails.newAgStackInstance().then(callback);\n }\n hideTooltip(forceHide) {\n if (!forceHide && this.isInteractingWithTooltip) {\n return;\n }\n // check if comp exists - due to async, although we asked for\n // one, the instance may not be back yet\n if (this.tooltipComp) {\n this.destroyTooltipComp();\n CustomTooltipFeature.lastTooltipHideTime = new Date().getTime();\n }\n const event = {\n type: Events.EVENT_TOOLTIP_HIDE,\n parentGui: this.parentComp.getGui()\n };\n this.eventService.dispatchEvent(event);\n this.state = TooltipStates.NOTHING;\n }\n newTooltipComponentCallback(tooltipInstanceCopy, tooltipComp) {\n const compNoLongerNeeded = this.state !== TooltipStates.SHOWING || this.tooltipInstanceCount !== tooltipInstanceCopy;\n if (compNoLongerNeeded) {\n this.getContext().destroyBean(tooltipComp);\n return;\n }\n const eGui = tooltipComp.getGui();\n this.tooltipComp = tooltipComp;\n if (!eGui.classList.contains('ag-tooltip')) {\n eGui.classList.add('ag-tooltip-custom');\n }\n if (this.tooltipTrigger === TooltipTrigger.HOVER) {\n eGui.classList.add('ag-tooltip-animate');\n }\n if (this.interactionEnabled) {\n eGui.classList.add('ag-tooltip-interactive');\n }\n const translate = this.localeService.getLocaleTextFunc();\n const addPopupRes = this.popupService.addPopup({\n eChild: eGui,\n ariaLabel: translate('ariaLabelTooltip', 'Tooltip')\n });\n if (addPopupRes) {\n this.tooltipPopupDestroyFunc = addPopupRes.hideFunc;\n }\n this.positionTooltip();\n if (this.tooltipTrigger === TooltipTrigger.FOCUS) {\n this.onBodyScrollEventCallback = this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, this.setToDoNothing.bind(this));\n this.onColumnMovedEventCallback = this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, this.setToDoNothing.bind(this));\n }\n if (this.interactionEnabled) {\n if (this.tooltipTrigger === TooltipTrigger.HOVER) {\n this.tooltipMouseEnterListener = this.addManagedListener(eGui, 'mouseenter', this.onTooltipMouseEnter.bind(this)) || null;\n this.tooltipMouseLeaveListener = this.addManagedListener(eGui, 'mouseleave', this.onTooltipMouseLeave.bind(this)) || null;\n }\n else {\n this.tooltipFocusInListener = this.addManagedListener(eGui, 'focusin', this.onTooltipFocusIn.bind(this)) || null;\n this.tooltipFocusOutListener = this.addManagedListener(eGui, 'focusout', this.onTooltipFocusOut.bind(this)) || null;\n }\n }\n const event = {\n type: Events.EVENT_TOOLTIP_SHOW,\n tooltipGui: eGui,\n parentGui: this.parentComp.getGui()\n };\n this.eventService.dispatchEvent(event);\n this.startHideTimeout();\n }\n onTooltipMouseEnter() {\n this.isInteractingWithTooltip = true;\n this.unlockService();\n }\n onTooltipMouseLeave() {\n this.isInteractingWithTooltip = false;\n this.lockService();\n }\n onTooltipFocusIn() {\n this.isInteractingWithTooltip = true;\n }\n onTooltipFocusOut(e) {\n var _a;\n const parentGui = this.parentComp.getGui();\n const tooltipGui = (_a = this.tooltipComp) === null || _a === void 0 ? void 0 : _a.getGui();\n const relatedTarget = e.relatedTarget;\n // focusout is dispatched when inner elements lose focus\n // so we need to verify if focus is contained within the tooltip\n if (tooltipGui === null || tooltipGui === void 0 ? void 0 : tooltipGui.contains(relatedTarget)) {\n return;\n }\n this.isInteractingWithTooltip = false;\n // if we move the focus from the tooltip back to the original cell\n // the tooltip should remain open, but we need to restart the hide timeout counter\n if (parentGui.contains(relatedTarget)) {\n this.startHideTimeout();\n }\n // if the parent cell doesn't contain the focus, simply hide the tooltip\n else {\n this.hideTooltip();\n }\n }\n positionTooltip() {\n const params = {\n type: 'tooltip',\n ePopup: this.tooltipComp.getGui(),\n nudgeY: 18,\n skipObserver: this.tooltipMouseTrack\n };\n if (this.lastMouseEvent) {\n this.popupService.positionPopupUnderMouseEvent(Object.assign(Object.assign({}, params), { mouseEvent: this.lastMouseEvent }));\n }\n else {\n this.popupService.positionPopupByComponent(Object.assign(Object.assign({}, params), { eventSource: this.parentComp.getGui(), position: 'under', keepWithinBounds: true, nudgeY: 5 }));\n }\n }\n destroyTooltipComp() {\n // add class to fade out the tooltip\n this.tooltipComp.getGui().classList.add('ag-tooltip-hiding');\n // make local copies of these variables, as we use them in the async function below,\n // and we clear then to 'undefined' later, so need to take a copy before they are undefined.\n const tooltipPopupDestroyFunc = this.tooltipPopupDestroyFunc;\n const tooltipComp = this.tooltipComp;\n const delay = this.tooltipTrigger === TooltipTrigger.HOVER ? this.FADE_OUT_TOOLTIP_TIMEOUT : 0;\n window.setTimeout(() => {\n tooltipPopupDestroyFunc();\n this.getContext().destroyBean(tooltipComp);\n }, delay);\n this.clearTooltipListeners();\n this.tooltipPopupDestroyFunc = undefined;\n this.tooltipComp = undefined;\n }\n clearTooltipListeners() {\n [\n this.tooltipMouseEnterListener, this.tooltipMouseLeaveListener,\n this.tooltipFocusInListener, this.tooltipFocusOutListener\n ].forEach(listener => {\n if (listener) {\n listener();\n }\n });\n this.tooltipMouseEnterListener = this.tooltipMouseLeaveListener =\n this.tooltipFocusInListener = this.tooltipFocusOutListener = null;\n }\n lockService() {\n CustomTooltipFeature.isLocked = true;\n this.interactiveTooltipTimeoutId = window.setTimeout(() => {\n this.unlockService();\n this.setToDoNothing();\n }, this.INTERACTIVE_HIDE_DELAY);\n }\n unlockService() {\n CustomTooltipFeature.isLocked = false;\n this.clearInteractiveTimeout();\n }\n startHideTimeout() {\n this.clearHideTimeout();\n this.hideTooltipTimeoutId = window.setTimeout(this.hideTooltip.bind(this), this.tooltipHideDelay);\n }\n clearShowTimeout() {\n if (!this.showTooltipTimeoutId) {\n return;\n }\n window.clearTimeout(this.showTooltipTimeoutId);\n this.showTooltipTimeoutId = undefined;\n }\n clearHideTimeout() {\n if (!this.hideTooltipTimeoutId) {\n return;\n }\n window.clearTimeout(this.hideTooltipTimeoutId);\n this.hideTooltipTimeoutId = undefined;\n }\n clearInteractiveTimeout() {\n if (!this.interactiveTooltipTimeoutId) {\n return;\n }\n window.clearTimeout(this.interactiveTooltipTimeoutId);\n this.interactiveTooltipTimeoutId = undefined;\n }\n clearTimeouts() {\n this.clearShowTimeout();\n this.clearHideTimeout();\n this.clearInteractiveTimeout();\n }\n}\nCustomTooltipFeature.isLocked = false;\n__decorate([\n Autowired('popupService')\n], CustomTooltipFeature.prototype, \"popupService\", void 0);\n__decorate([\n Autowired('userComponentFactory')\n], CustomTooltipFeature.prototype, \"userComponentFactory\", void 0);\n__decorate([\n PostConstruct\n], CustomTooltipFeature.prototype, \"postConstruct\", null);\n","export class CssClassManager {\n constructor(getGui) {\n // to minimise DOM hits, we only apply CSS classes if they have changed. as adding a CSS class that is already\n // there, or removing one that wasn't present, all takes CPU.\n this.cssClassStates = {};\n this.getGui = getGui;\n }\n addCssClass(className) {\n const list = (className || '').split(' ');\n if (list.length > 1) {\n list.forEach(cls => this.addCssClass(cls));\n return;\n }\n const updateNeeded = this.cssClassStates[className] !== true;\n if (updateNeeded && className.length) {\n const eGui = this.getGui();\n if (eGui) {\n eGui.classList.add(className);\n }\n this.cssClassStates[className] = true;\n }\n }\n removeCssClass(className) {\n const list = (className || '').split(' ');\n if (list.length > 1) {\n list.forEach(cls => this.removeCssClass(cls));\n return;\n }\n const updateNeeded = this.cssClassStates[className] !== false;\n if (updateNeeded && className.length) {\n const eGui = this.getGui();\n if (eGui) {\n eGui.classList.remove(className);\n }\n this.cssClassStates[className] = false;\n }\n }\n containsCssClass(className) {\n const eGui = this.getGui();\n if (!eGui) {\n return false;\n }\n return eGui.classList.contains(className);\n }\n addOrRemoveCssClass(className, addOrRemove) {\n if (!className) {\n return;\n }\n // we check for spaces before doing the split, as doing the split\n // created a performance problem (on windows only, see AG-6765)\n if (className.indexOf(' ') >= 0) {\n const list = (className || '').split(' ');\n if (list.length > 1) {\n list.forEach(cls => this.addOrRemoveCssClass(cls, addOrRemove));\n return;\n }\n }\n const updateNeeded = this.cssClassStates[className] !== addOrRemove;\n if (updateNeeded && className.length) {\n const eGui = this.getGui();\n if (eGui) {\n eGui.classList.toggle(className, addOrRemove);\n }\n this.cssClassStates[className] = addOrRemove;\n }\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PreConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { NumberSequence } from \"../utils/index.mjs\";\nimport { isNodeOrElement, copyNodeList, iterateNamedNodeMap, loadTemplate, setVisible, setDisplayed } from '../utils/dom.mjs';\nimport { getFunctionName } from '../utils/function.mjs';\nimport { CustomTooltipFeature } from \"./customTooltipFeature.mjs\";\nimport { CssClassManager } from \"../rendering/cssClassManager.mjs\";\nconst compIdSequence = new NumberSequence();\nexport class Component extends BeanStub {\n constructor(template) {\n super();\n // if false, then CSS class \"ag-hidden\" is applied, which sets \"display: none\"\n this.displayed = true;\n // if false, then CSS class \"ag-invisible\" is applied, which sets \"visibility: hidden\"\n this.visible = true;\n // unique id for this row component. this is used for getting a reference to the HTML dom.\n // we cannot use the RowNode id as this is not unique (due to animation, old rows can be lying\n // around as we create a new rowComp instance for the same row node).\n this.compId = compIdSequence.next();\n this.cssClassManager = new CssClassManager(() => this.eGui);\n if (template) {\n this.setTemplate(template);\n }\n }\n preConstructOnComponent() {\n this.usingBrowserTooltips = this.gridOptionsService.is('enableBrowserTooltips');\n }\n getCompId() {\n return this.compId;\n }\n getTooltipParams() {\n return {\n value: this.tooltipText,\n location: 'UNKNOWN'\n };\n }\n setTooltip(newTooltipText, showDelayOverride, hideDelayOverride) {\n const removeTooltip = () => {\n if (this.usingBrowserTooltips) {\n this.getGui().removeAttribute('title');\n }\n else {\n this.tooltipFeature = this.destroyBean(this.tooltipFeature);\n }\n };\n const addTooltip = () => {\n if (this.usingBrowserTooltips) {\n this.getGui().setAttribute('title', this.tooltipText);\n }\n else {\n this.tooltipFeature = this.createBean(new CustomTooltipFeature(this, showDelayOverride, hideDelayOverride));\n }\n };\n if (this.tooltipText != newTooltipText) {\n if (this.tooltipText) {\n removeTooltip();\n }\n if (newTooltipText != null) {\n this.tooltipText = newTooltipText;\n if (this.tooltipText) {\n addTooltip();\n }\n }\n }\n }\n // for registered components only, eg creates AgCheckbox instance from ag-checkbox HTML tag\n createChildComponentsFromTags(parentNode, paramsMap) {\n // we MUST take a copy of the list first, as the 'swapComponentForNode' adds comments into the DOM\n // which messes up the traversal order of the children.\n const childNodeList = copyNodeList(parentNode.childNodes);\n childNodeList.forEach(childNode => {\n if (!(childNode instanceof HTMLElement)) {\n return;\n }\n const childComp = this.createComponentFromElement(childNode, childComp => {\n // copy over all attributes, including css classes, so any attributes user put on the tag\n // wll be carried across\n const childGui = childComp.getGui();\n if (childGui) {\n this.copyAttributesFromNode(childNode, childComp.getGui());\n }\n }, paramsMap);\n if (childComp) {\n if (childComp.addItems && childNode.children.length) {\n this.createChildComponentsFromTags(childNode, paramsMap);\n // converting from HTMLCollection to Array\n const items = Array.prototype.slice.call(childNode.children);\n childComp.addItems(items);\n }\n // replace the tag (eg ag-checkbox) with the proper HTMLElement (eg 'div') in the dom\n this.swapComponentForNode(childComp, parentNode, childNode);\n }\n else if (childNode.childNodes) {\n this.createChildComponentsFromTags(childNode, paramsMap);\n }\n });\n }\n createComponentFromElement(element, afterPreCreateCallback, paramsMap) {\n const key = element.nodeName;\n const componentParams = paramsMap ? paramsMap[element.getAttribute('ref')] : undefined;\n const ComponentClass = this.agStackComponentsRegistry.getComponentClass(key);\n if (ComponentClass) {\n Component.elementGettingCreated = element;\n const newComponent = new ComponentClass(componentParams);\n newComponent.setParentComponent(this);\n this.createBean(newComponent, null, afterPreCreateCallback);\n return newComponent;\n }\n return null;\n }\n copyAttributesFromNode(source, dest) {\n iterateNamedNodeMap(source.attributes, (name, value) => dest.setAttribute(name, value));\n }\n swapComponentForNode(newComponent, parentNode, childNode) {\n const eComponent = newComponent.getGui();\n parentNode.replaceChild(eComponent, childNode);\n parentNode.insertBefore(document.createComment(childNode.nodeName), eComponent);\n this.addDestroyFunc(this.destroyBean.bind(this, newComponent));\n this.swapInComponentForQuerySelectors(newComponent, childNode);\n }\n swapInComponentForQuerySelectors(newComponent, childNode) {\n const thisNoType = this;\n this.iterateOverQuerySelectors((querySelector) => {\n if (thisNoType[querySelector.attributeName] === childNode) {\n thisNoType[querySelector.attributeName] = newComponent;\n }\n });\n }\n iterateOverQuerySelectors(action) {\n let thisPrototype = Object.getPrototypeOf(this);\n while (thisPrototype != null) {\n const metaData = thisPrototype.__agComponentMetaData;\n const currentProtoName = getFunctionName(thisPrototype.constructor);\n if (metaData && metaData[currentProtoName] && metaData[currentProtoName].querySelectors) {\n metaData[currentProtoName].querySelectors.forEach((querySelector) => action(querySelector));\n }\n thisPrototype = Object.getPrototypeOf(thisPrototype);\n }\n }\n activateTabIndex(elements) {\n const tabIndex = this.gridOptionsService.getNum('tabIndex') || 0;\n if (!elements) {\n elements = [];\n }\n if (!elements.length) {\n elements.push(this.getGui());\n }\n elements.forEach(el => el.setAttribute('tabindex', tabIndex.toString()));\n }\n setTemplate(template, paramsMap) {\n const eGui = loadTemplate(template);\n this.setTemplateFromElement(eGui, paramsMap);\n }\n setTemplateFromElement(element, paramsMap) {\n this.eGui = element;\n this.eGui.__agComponent = this;\n this.wireQuerySelectors();\n // context will not be available when user sets template in constructor\n if (!!this.getContext()) {\n this.createChildComponentsFromTags(this.getGui(), paramsMap);\n }\n }\n createChildComponentsPreConstruct() {\n // ui exists if user sets template in constructor. when this happens, we have to wait for the context\n // to be autoWired first before we can create child components.\n if (!!this.getGui()) {\n this.createChildComponentsFromTags(this.getGui());\n }\n }\n wireQuerySelectors() {\n if (!this.eGui) {\n return;\n }\n const thisNoType = this;\n this.iterateOverQuerySelectors((querySelector) => {\n const setResult = (result) => thisNoType[querySelector.attributeName] = result;\n // if it's a ref selector, and match is on top level component, we return\n // the element. otherwise no way of components putting ref=xxx on the top\n // level element as querySelector only looks at children.\n const topLevelRefMatch = querySelector.refSelector\n && this.getAttribute('ref') === querySelector.refSelector;\n if (topLevelRefMatch) {\n setResult(this.eGui);\n }\n else {\n // otherwise use querySelector, which looks at children\n const resultOfQuery = this.eGui.querySelector(querySelector.querySelector);\n if (resultOfQuery) {\n setResult(resultOfQuery.__agComponent || resultOfQuery);\n }\n }\n });\n }\n getGui() {\n return this.eGui;\n }\n getFocusableElement() {\n return this.eGui;\n }\n setParentComponent(component) {\n this.parentComponent = component;\n }\n getParentComponent() {\n return this.parentComponent;\n }\n // this method is for older code, that wants to provide the gui element,\n // it is not intended for this to be in ag-Stack\n setGui(eGui) {\n this.eGui = eGui;\n }\n queryForHtmlElement(cssSelector) {\n return this.eGui.querySelector(cssSelector);\n }\n queryForHtmlInputElement(cssSelector) {\n return this.eGui.querySelector(cssSelector);\n }\n appendChild(newChild, container) {\n if (newChild == null) {\n return;\n }\n if (!container) {\n container = this.eGui;\n }\n if (isNodeOrElement(newChild)) {\n container.appendChild(newChild);\n }\n else {\n const childComponent = newChild;\n container.appendChild(childComponent.getGui());\n }\n }\n isDisplayed() {\n return this.displayed;\n }\n setVisible(visible, options = {}) {\n if (visible !== this.visible) {\n this.visible = visible;\n const { skipAriaHidden } = options;\n setVisible(this.eGui, visible, { skipAriaHidden });\n }\n }\n setDisplayed(displayed, options = {}) {\n if (displayed !== this.displayed) {\n this.displayed = displayed;\n const { skipAriaHidden } = options;\n setDisplayed(this.eGui, displayed, { skipAriaHidden });\n const event = {\n type: Component.EVENT_DISPLAYED_CHANGED,\n visible: this.displayed\n };\n this.dispatchEvent(event);\n }\n }\n destroy() {\n if (this.tooltipFeature) {\n this.tooltipFeature = this.destroyBean(this.tooltipFeature);\n }\n if (this.parentComponent) {\n this.parentComponent = undefined;\n }\n const eGui = this.eGui;\n if (eGui && eGui.__agComponent) {\n eGui.__agComponent = undefined;\n }\n super.destroy();\n }\n addGuiEventListener(event, listener, options) {\n this.eGui.addEventListener(event, listener, options);\n this.addDestroyFunc(() => this.eGui.removeEventListener(event, listener));\n }\n addCssClass(className) {\n this.cssClassManager.addCssClass(className);\n }\n removeCssClass(className) {\n this.cssClassManager.removeCssClass(className);\n }\n containsCssClass(className) {\n return this.cssClassManager.containsCssClass(className);\n }\n addOrRemoveCssClass(className, addOrRemove) {\n this.cssClassManager.addOrRemoveCssClass(className, addOrRemove);\n }\n getAttribute(key) {\n const { eGui } = this;\n return eGui ? eGui.getAttribute(key) : null;\n }\n getRefElement(refName) {\n return this.queryForHtmlElement(`[ref=\"${refName}\"]`);\n }\n}\nComponent.EVENT_DISPLAYED_CHANGED = 'displayedChanged';\n__decorate([\n Autowired('agStackComponentsRegistry')\n], Component.prototype, \"agStackComponentsRegistry\", void 0);\n__decorate([\n PreConstruct\n], Component.prototype, \"preConstructOnComponent\", null);\n__decorate([\n PreConstruct\n], Component.prototype, \"createChildComponentsPreConstruct\", null);\n","import { getFunctionName } from '../utils/function.mjs';\nexport function QuerySelector(selector) {\n return querySelectorFunc.bind(this, selector, undefined);\n}\nexport function RefSelector(ref) {\n return querySelectorFunc.bind(this, `[ref=${ref}]`, ref);\n}\nfunction querySelectorFunc(selector, refSelector, classPrototype, methodOrAttributeName, index) {\n if (selector === null) {\n console.error('AG Grid: QuerySelector selector should not be null');\n return;\n }\n if (typeof index === 'number') {\n console.error('AG Grid: QuerySelector should be on an attribute');\n return;\n }\n addToObjectProps(classPrototype, 'querySelectors', {\n attributeName: methodOrAttributeName,\n querySelector: selector,\n refSelector: refSelector\n });\n}\n// // think we should take this out, put property bindings on the\n// export function Method(eventName?: string): Function {\n// return methodFunc.bind(this, eventName);\n// }\n//\n// function methodFunc(alias: string, target: Object, methodName: string) {\n// if (alias === null) {\n// console.error(\"AG Grid: EventListener eventName should not be null\");\n// return;\n// }\n//\n// addToObjectProps(target, 'methods', {\n// methodName: methodName,\n// alias: alias\n// });\n// }\nfunction addToObjectProps(target, key, value) {\n // it's an attribute on the class\n const props = getOrCreateProps(target, getFunctionName(target.constructor));\n if (!props[key]) {\n props[key] = [];\n }\n props[key].push(value);\n}\nfunction getOrCreateProps(target, instanceName) {\n if (!target.__agComponentMetaData) {\n target.__agComponentMetaData = {};\n }\n if (!target.__agComponentMetaData[instanceName]) {\n target.__agComponentMetaData[instanceName] = {};\n }\n return target.__agComponentMetaData[instanceName];\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from '../../../widgets/component.mjs';\nimport { RefSelector } from '../../../widgets/componentAnnotations.mjs';\nimport { Autowired } from '../../../context/context.mjs';\n// optional floating filter for user provided filters - instead of providing a floating filter,\n// they can provide a getModelAsString() method on the filter instead. this class just displays\n// the string returned from getModelAsString()\nexport class ReadOnlyFloatingFilter extends Component {\n constructor() {\n super(/* html */ `\n
\n \n
`);\n }\n // this is a user component, and IComponent has \"public destroy()\" as part of the interface.\n // so we need to override destroy() just to make the method public.\n destroy() {\n super.destroy();\n }\n init(params) {\n this.params = params;\n const displayName = this.columnModel.getDisplayNameForColumn(params.column, 'header', true);\n const translate = this.localeService.getLocaleTextFunc();\n this.eFloatingFilterText\n .setDisabled(true)\n .setInputAriaLabel(`${displayName} ${translate('ariaFilterInput', 'Filter Input')}`);\n }\n onParentModelChanged(parentModel) {\n if (!parentModel) {\n this.eFloatingFilterText.setValue('');\n return;\n }\n this.params.parentFilterInstance(filterInstance => {\n // it would be nice to check if getModelAsString was present before creating this component,\n // however that is not possible, as React Hooks and VueJS don't attached the methods to the Filter until\n // AFTER the filter is created, not allowing inspection before this (we create floating filters as columns\n // are drawn, but the parent filters are only created when needed).\n if (filterInstance.getModelAsString) {\n const modelAsString = filterInstance.getModelAsString(parentModel);\n this.eFloatingFilterText.setValue(modelAsString);\n }\n });\n }\n onParamsUpdated(params) {\n this.init(params);\n }\n}\n__decorate([\n RefSelector('eFloatingFilterText')\n], ReadOnlyFloatingFilter.prototype, \"eFloatingFilterText\", void 0);\n__decorate([\n Autowired('columnModel')\n], ReadOnlyFloatingFilter.prototype, \"columnModel\", void 0);\n","import { setDisplayed } from '../../../utils/dom.mjs';\n/** Provides sync access to async component. Date component can be lazy created - this class encapsulates\n * this by keeping value locally until DateComp has loaded, then passing DateComp the value. */\nexport class DateCompWrapper {\n constructor(context, userComponentFactory, dateComponentParams, eParent) {\n this.alive = true;\n this.context = context;\n this.eParent = eParent;\n const compDetails = userComponentFactory.getDateCompDetails(dateComponentParams);\n const promise = compDetails.newAgStackInstance();\n promise.then(dateComp => {\n // because async, check the filter still exists after component comes back\n if (!this.alive) {\n context.destroyBean(dateComp);\n return;\n }\n this.dateComp = dateComp;\n if (!dateComp) {\n return;\n }\n eParent.appendChild(dateComp.getGui());\n if (dateComp.afterGuiAttached) {\n dateComp.afterGuiAttached();\n }\n if (this.tempValue) {\n dateComp.setDate(this.tempValue);\n }\n if (this.disabled != null) {\n this.setDateCompDisabled(this.disabled);\n }\n });\n }\n destroy() {\n this.alive = false;\n this.dateComp = this.context.destroyBean(this.dateComp);\n }\n getDate() {\n return this.dateComp ? this.dateComp.getDate() : this.tempValue;\n }\n setDate(value) {\n if (this.dateComp) {\n this.dateComp.setDate(value);\n }\n else {\n this.tempValue = value;\n }\n }\n setDisabled(disabled) {\n if (this.dateComp) {\n this.setDateCompDisabled(disabled);\n }\n else {\n this.disabled = disabled;\n }\n }\n setDisplayed(displayed) {\n setDisplayed(this.eParent, displayed);\n }\n setInputPlaceholder(placeholder) {\n if (this.dateComp && this.dateComp.setInputPlaceholder) {\n this.dateComp.setInputPlaceholder(placeholder);\n }\n }\n setInputAriaLabel(label) {\n if (this.dateComp && this.dateComp.setInputAriaLabel) {\n this.dateComp.setInputAriaLabel(label);\n }\n }\n afterGuiAttached(params) {\n if (this.dateComp && typeof this.dateComp.afterGuiAttached === 'function') {\n this.dateComp.afterGuiAttached(params);\n }\n }\n updateParams(params) {\n var _a;\n if (((_a = this.dateComp) === null || _a === void 0 ? void 0 : _a.onParamsUpdated) && typeof this.dateComp.onParamsUpdated === 'function') {\n this.dateComp.onParamsUpdated(params);\n }\n }\n setDateCompDisabled(disabled) {\n if (this.dateComp == null) {\n return;\n }\n if (this.dateComp.setDisabled == null) {\n return;\n }\n this.dateComp.setDisabled(disabled);\n }\n}\n","/* Common logic for options, used by both filters and floating filters. */\nexport class OptionsFactory {\n constructor() {\n this.customFilterOptions = {};\n }\n init(params, defaultOptions) {\n this.filterOptions = params.filterOptions || defaultOptions;\n this.mapCustomOptions();\n this.selectDefaultItem(params);\n }\n getFilterOptions() {\n return this.filterOptions;\n }\n mapCustomOptions() {\n if (!this.filterOptions) {\n return;\n }\n this.filterOptions.forEach(filterOption => {\n if (typeof filterOption === 'string') {\n return;\n }\n const requiredProperties = [['displayKey'], ['displayName'], ['predicate', 'test']];\n const propertyCheck = (keys) => {\n if (!keys.some(key => filterOption[key] != null)) {\n console.warn(`AG Grid: ignoring FilterOptionDef as it doesn't contain one of '${keys}'`);\n return false;\n }\n return true;\n };\n if (!requiredProperties.every(propertyCheck)) {\n this.filterOptions = this.filterOptions.filter(v => v === filterOption) || [];\n return;\n }\n this.customFilterOptions[filterOption.displayKey] = filterOption;\n });\n }\n selectDefaultItem(params) {\n if (params.defaultOption) {\n this.defaultOption = params.defaultOption;\n }\n else if (this.filterOptions.length >= 1) {\n const firstFilterOption = this.filterOptions[0];\n if (typeof firstFilterOption === 'string') {\n this.defaultOption = firstFilterOption;\n }\n else if (firstFilterOption.displayKey) {\n this.defaultOption = firstFilterOption.displayKey;\n }\n else {\n console.warn(`AG Grid: invalid FilterOptionDef supplied as it doesn't contain a 'displayKey'`);\n }\n }\n else {\n console.warn('AG Grid: no filter options for filter');\n }\n }\n getDefaultOption() {\n return this.defaultOption;\n }\n getCustomOption(name) {\n return this.customFilterOptions[name];\n }\n}\n","export const DEFAULT_FILTER_LOCALE_TEXT = {\n applyFilter: 'Apply',\n clearFilter: 'Clear',\n resetFilter: 'Reset',\n cancelFilter: 'Cancel',\n textFilter: 'Text Filter',\n numberFilter: 'Number Filter',\n dateFilter: 'Date Filter',\n setFilter: 'Set Filter',\n filterOoo: 'Filter...',\n empty: 'Choose One',\n equals: 'Equals',\n notEqual: 'Not equal',\n lessThan: 'Less than',\n greaterThan: 'Greater than',\n inRange: 'In range',\n inRangeStart: 'From',\n inRangeEnd: 'To',\n lessThanOrEqual: 'Less than or equals',\n greaterThanOrEqual: 'Greater than or equals',\n contains: 'Contains',\n notContains: 'Not contains',\n startsWith: 'Starts with',\n endsWith: 'Ends with',\n blank: 'Blank',\n notBlank: 'Not blank',\n andCondition: 'AND',\n orCondition: 'OR',\n dateFormatOoo: 'yyyy-mm-dd',\n};\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PostConstruct, Autowired } from '../context/context.mjs';\nimport { KeyCode } from '../constants/keyCode.mjs';\nimport { isStopPropagationForAgGrid, stopPropagationForAgGrid } from '../utils/event.mjs';\nimport { BeanStub } from '../context/beanStub.mjs';\nexport class ManagedFocusFeature extends BeanStub {\n constructor(eFocusableElement, callbacks = {}) {\n super();\n this.eFocusableElement = eFocusableElement;\n this.callbacks = callbacks;\n this.callbacks = Object.assign({ shouldStopEventPropagation: () => false, onTabKeyDown: (e) => {\n if (e.defaultPrevented) {\n return;\n }\n const nextRoot = this.focusService.findNextFocusableElement(this.eFocusableElement, false, e.shiftKey);\n if (!nextRoot) {\n return;\n }\n nextRoot.focus();\n e.preventDefault();\n } }, callbacks);\n }\n postConstruct() {\n this.eFocusableElement.classList.add(ManagedFocusFeature.FOCUS_MANAGED_CLASS);\n this.addKeyDownListeners(this.eFocusableElement);\n if (this.callbacks.onFocusIn) {\n this.addManagedListener(this.eFocusableElement, 'focusin', this.callbacks.onFocusIn);\n }\n if (this.callbacks.onFocusOut) {\n this.addManagedListener(this.eFocusableElement, 'focusout', this.callbacks.onFocusOut);\n }\n }\n addKeyDownListeners(eGui) {\n this.addManagedListener(eGui, 'keydown', (e) => {\n if (e.defaultPrevented || isStopPropagationForAgGrid(e)) {\n return;\n }\n if (this.callbacks.shouldStopEventPropagation(e)) {\n stopPropagationForAgGrid(e);\n return;\n }\n if (e.key === KeyCode.TAB) {\n this.callbacks.onTabKeyDown(e);\n }\n else if (this.callbacks.handleKeyDown) {\n this.callbacks.handleKeyDown(e);\n }\n });\n }\n}\nManagedFocusFeature.FOCUS_MANAGED_CLASS = 'ag-focus-managed';\n__decorate([\n Autowired('focusService')\n], ManagedFocusFeature.prototype, \"focusService\", void 0);\n__decorate([\n PostConstruct\n], ManagedFocusFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired } from \"../../context/context.mjs\";\nimport { getAbsoluteHeight, getAbsoluteWidth, setFixedHeight, setFixedWidth } from \"../../utils/dom.mjs\";\nconst RESIZE_CONTAINER_STYLE = 'ag-resizer-wrapper';\nconst RESIZE_TEMPLATE = /* html */ `
\n
\n
\n
\n
\n
\n
\n
\n
\n
`;\nexport class PositionableFeature extends BeanStub {\n constructor(element, config) {\n super();\n this.element = element;\n this.dragStartPosition = {\n x: 0,\n y: 0\n };\n this.position = {\n x: 0,\n y: 0\n };\n this.lastSize = {\n width: -1,\n height: -1\n };\n this.positioned = false;\n this.resizersAdded = false;\n this.resizeListeners = [];\n this.boundaryEl = null;\n this.isResizing = false;\n this.isMoving = false;\n this.resizable = {};\n this.movable = false;\n this.currentResizer = null;\n this.config = Object.assign({}, { popup: false }, config);\n }\n center() {\n const { clientHeight, clientWidth } = this.offsetParent;\n const x = (clientWidth / 2) - (this.getWidth() / 2);\n const y = (clientHeight / 2) - (this.getHeight() / 2);\n this.offsetElement(x, y);\n }\n initialisePosition() {\n if (this.positioned) {\n return;\n }\n const { centered, forcePopupParentAsOffsetParent, minWidth, width, minHeight, height, x, y } = this.config;\n if (!this.offsetParent) {\n this.setOffsetParent();\n }\n let computedMinHeight = 0;\n let computedMinWidth = 0;\n // here we don't use the main offset parent but the element's offsetParent\n // in order to calculated the minWidth and minHeight correctly\n const isVisible = !!this.element.offsetParent;\n if (isVisible) {\n const boundaryEl = this.findBoundaryElement();\n const offsetParentComputedStyles = window.getComputedStyle(boundaryEl);\n if (offsetParentComputedStyles.minWidth != null) {\n const paddingWidth = boundaryEl.offsetWidth - this.element.offsetWidth;\n computedMinWidth = parseInt(offsetParentComputedStyles.minWidth, 10) - paddingWidth;\n }\n if (offsetParentComputedStyles.minHeight != null) {\n const paddingHeight = boundaryEl.offsetHeight - this.element.offsetHeight;\n computedMinHeight = parseInt(offsetParentComputedStyles.minHeight, 10) - paddingHeight;\n }\n }\n this.minHeight = minHeight || computedMinHeight;\n this.minWidth = minWidth || computedMinWidth;\n if (width) {\n this.setWidth(width);\n }\n if (height) {\n this.setHeight(height);\n }\n if (!width || !height) {\n this.refreshSize();\n }\n if (centered) {\n this.center();\n }\n else if (x || y) {\n this.offsetElement(x, y);\n }\n else if (isVisible && forcePopupParentAsOffsetParent) {\n let boundaryEl = this.boundaryEl;\n let initialisedDuringPositioning = true;\n if (!boundaryEl) {\n boundaryEl = this.findBoundaryElement();\n initialisedDuringPositioning = false;\n }\n if (boundaryEl) {\n const top = parseFloat(boundaryEl.style.top);\n const left = parseFloat(boundaryEl.style.left);\n if (initialisedDuringPositioning) {\n this.offsetElement(isNaN(left) ? 0 : left, isNaN(top) ? 0 : top);\n }\n else {\n this.setPosition(left, top);\n }\n }\n }\n this.positioned = !!this.offsetParent;\n }\n isPositioned() {\n return this.positioned;\n }\n getPosition() {\n return this.position;\n }\n setMovable(movable, moveElement) {\n if (!this.config.popup || movable === this.movable) {\n return;\n }\n this.movable = movable;\n const params = this.moveElementDragListener || {\n eElement: moveElement,\n onDragStart: this.onMoveStart.bind(this),\n onDragging: this.onMove.bind(this),\n onDragStop: this.onMoveEnd.bind(this)\n };\n if (movable) {\n this.dragService.addDragSource(params);\n this.moveElementDragListener = params;\n }\n else {\n this.dragService.removeDragSource(params);\n this.moveElementDragListener = undefined;\n }\n }\n setResizable(resizable) {\n this.clearResizeListeners();\n if (resizable) {\n this.addResizers();\n }\n else {\n this.removeResizers();\n }\n if (typeof resizable === 'boolean') {\n if (resizable === false) {\n return;\n }\n resizable = {\n topLeft: resizable,\n top: resizable,\n topRight: resizable,\n right: resizable,\n bottomRight: resizable,\n bottom: resizable,\n bottomLeft: resizable,\n left: resizable\n };\n }\n Object.keys(resizable).forEach((side) => {\n const resizableStructure = resizable;\n const isSideResizable = !!resizableStructure[side];\n const resizerEl = this.getResizerElement(side);\n const params = {\n dragStartPixels: 0,\n eElement: resizerEl,\n onDragStart: (e) => this.onResizeStart(e, side),\n onDragging: this.onResize.bind(this),\n onDragStop: (e) => this.onResizeEnd(e, side),\n };\n if (isSideResizable || (!this.isAlive() && !isSideResizable)) {\n if (isSideResizable) {\n this.dragService.addDragSource(params);\n this.resizeListeners.push(params);\n resizerEl.style.pointerEvents = 'all';\n }\n else {\n resizerEl.style.pointerEvents = 'none';\n }\n this.resizable[side] = isSideResizable;\n }\n });\n }\n removeSizeFromEl() {\n this.element.style.removeProperty('height');\n this.element.style.removeProperty('width');\n this.element.style.removeProperty('flex');\n }\n restoreLastSize() {\n this.element.style.flex = '0 0 auto';\n const { height, width } = this.lastSize;\n if (width !== -1) {\n this.element.style.width = `${width}px`;\n }\n if (height !== -1) {\n this.element.style.height = `${height}px`;\n }\n }\n getHeight() {\n return this.element.offsetHeight;\n }\n setHeight(height) {\n const { popup } = this.config;\n const eGui = this.element;\n let isPercent = false;\n if (typeof height === 'string' && height.indexOf('%') !== -1) {\n setFixedHeight(eGui, height);\n height = getAbsoluteHeight(eGui);\n isPercent = true;\n }\n else {\n height = Math.max(this.minHeight, height);\n if (this.positioned) {\n const availableHeight = this.getAvailableHeight();\n if (availableHeight && height > availableHeight) {\n height = availableHeight;\n }\n }\n }\n if (this.getHeight() === height) {\n return;\n }\n if (!isPercent) {\n if (popup) {\n setFixedHeight(eGui, height);\n }\n else {\n eGui.style.height = `${height}px`;\n eGui.style.flex = '0 0 auto';\n this.lastSize.height = typeof height === 'number' ? height : parseFloat(height);\n }\n }\n else {\n eGui.style.maxHeight = 'unset';\n eGui.style.minHeight = 'unset';\n }\n }\n getAvailableHeight() {\n const { popup, forcePopupParentAsOffsetParent } = this.config;\n if (!this.positioned) {\n this.initialisePosition();\n }\n const { clientHeight } = this.offsetParent;\n if (!clientHeight) {\n return null;\n }\n const elRect = this.element.getBoundingClientRect();\n const offsetParentRect = this.offsetParent.getBoundingClientRect();\n const yPosition = popup ? this.position.y : elRect.top;\n const parentTop = popup ? 0 : offsetParentRect.top;\n // When `forcePopupParentAsOffsetParent`, there may be elements that appear after the resizable element, but aren't included in the height.\n // Take these into account here\n let additionalHeight = 0;\n if (forcePopupParentAsOffsetParent) {\n const parentEl = this.element.parentElement;\n if (parentEl) {\n const { bottom } = parentEl.getBoundingClientRect();\n additionalHeight = bottom - elRect.bottom;\n }\n }\n const availableHeight = clientHeight + parentTop - yPosition - additionalHeight;\n return availableHeight;\n }\n getWidth() {\n return this.element.offsetWidth;\n }\n setWidth(width) {\n const eGui = this.element;\n const { popup } = this.config;\n let isPercent = false;\n if (typeof width === 'string' && width.indexOf('%') !== -1) {\n setFixedWidth(eGui, width);\n width = getAbsoluteWidth(eGui);\n isPercent = true;\n }\n else if (this.positioned) {\n width = Math.max(this.minWidth, width);\n const { clientWidth } = this.offsetParent;\n const xPosition = popup ? this.position.x : this.element.getBoundingClientRect().left;\n if (clientWidth && (width + xPosition > clientWidth)) {\n width = clientWidth - xPosition;\n }\n }\n if (this.getWidth() === width) {\n return;\n }\n if (!isPercent) {\n if (this.config.popup) {\n setFixedWidth(eGui, width);\n }\n else {\n eGui.style.width = `${width}px`;\n eGui.style.flex = ' unset';\n this.lastSize.width = typeof width === 'number' ? width : parseFloat(width);\n }\n }\n else {\n eGui.style.maxWidth = 'unset';\n eGui.style.minWidth = 'unset';\n }\n }\n offsetElement(x = 0, y = 0) {\n const { forcePopupParentAsOffsetParent } = this.config;\n const ePopup = forcePopupParentAsOffsetParent ? this.boundaryEl : this.element;\n if (!ePopup) {\n return;\n }\n this.popupService.positionPopup({\n ePopup,\n keepWithinBounds: true,\n skipObserver: this.movable || this.isResizable(),\n updatePosition: () => ({ x, y })\n });\n this.setPosition(parseFloat(ePopup.style.left), parseFloat(ePopup.style.top));\n }\n constrainSizeToAvailableHeight(constrain) {\n if (!this.config.forcePopupParentAsOffsetParent) {\n return;\n }\n const applyMaxHeightToElement = () => {\n const availableHeight = this.getAvailableHeight();\n this.element.style.setProperty('max-height', `${availableHeight}px`);\n };\n if (constrain) {\n this.resizeObserverSubscriber = this.resizeObserverService.observeResize(this.popupService.getPopupParent(), applyMaxHeightToElement);\n }\n else {\n this.element.style.removeProperty('max-height');\n if (this.resizeObserverSubscriber) {\n this.resizeObserverSubscriber();\n this.resizeObserverSubscriber = undefined;\n }\n }\n }\n setPosition(x, y) {\n this.position.x = x;\n this.position.y = y;\n }\n updateDragStartPosition(x, y) {\n this.dragStartPosition = { x, y };\n }\n calculateMouseMovement(params) {\n const { e, isLeft, isTop, anywhereWithin, topBuffer } = params;\n const xDiff = e.clientX - this.dragStartPosition.x;\n const yDiff = e.clientY - this.dragStartPosition.y;\n const movementX = this.shouldSkipX(e, !!isLeft, !!anywhereWithin, xDiff) ? 0 : xDiff;\n const movementY = this.shouldSkipY(e, !!isTop, topBuffer, yDiff) ? 0 : yDiff;\n return { movementX, movementY };\n }\n shouldSkipX(e, isLeft, anywhereWithin, diff) {\n const elRect = this.element.getBoundingClientRect();\n const parentRect = this.offsetParent.getBoundingClientRect();\n const boundaryElRect = this.boundaryEl.getBoundingClientRect();\n const xPosition = this.config.popup ? this.position.x : elRect.left;\n // skip if cursor is outside of popupParent horizontally\n let skipX = ((xPosition <= 0 && parentRect.left >= e.clientX) ||\n (parentRect.right <= e.clientX && parentRect.right <= boundaryElRect.right));\n if (skipX) {\n return true;\n }\n if (isLeft) {\n skipX = (\n // skip if we are moving to the left and the cursor\n // is positioned to the right of the left side anchor\n (diff < 0 && e.clientX > xPosition + parentRect.left) ||\n // skip if we are moving to the right and the cursor\n // is positioned to the left of the dialog\n (diff > 0 && e.clientX < xPosition + parentRect.left));\n }\n else {\n if (anywhereWithin) {\n // if anywhereWithin is true, we allow to move\n // as long as the cursor is within the dialog\n skipX = ((diff < 0 && e.clientX > boundaryElRect.right) ||\n (diff > 0 && e.clientX < xPosition + parentRect.left));\n }\n else {\n skipX = (\n // if the movement is bound to the right side of the dialog\n // we skip if we are moving to the left and the cursor\n // is to the right of the dialog\n (diff < 0 && e.clientX > boundaryElRect.right) ||\n // or skip if we are moving to the right and the cursor\n // is to the left of the right side anchor\n (diff > 0 && e.clientX < boundaryElRect.right));\n }\n }\n return skipX;\n }\n shouldSkipY(e, isTop, topBuffer = 0, diff) {\n const elRect = this.element.getBoundingClientRect();\n const parentRect = this.offsetParent.getBoundingClientRect();\n const boundaryElRect = this.boundaryEl.getBoundingClientRect();\n const yPosition = this.config.popup ? this.position.y : elRect.top;\n // skip if cursor is outside of popupParent vertically\n let skipY = ((yPosition <= 0 && parentRect.top >= e.clientY) ||\n (parentRect.bottom <= e.clientY && parentRect.bottom <= boundaryElRect.bottom));\n if (skipY) {\n return true;\n }\n if (isTop) {\n skipY = (\n // skip if we are moving to towards top and the cursor is\n // below the top anchor + topBuffer\n // note: topBuffer is used when moving the dialog using the title bar\n (diff < 0 && e.clientY > yPosition + parentRect.top + topBuffer) ||\n // skip if we are moving to the bottom and the cursor is\n // above the top anchor\n (diff > 0 && e.clientY < yPosition + parentRect.top));\n }\n else {\n skipY = (\n // skip if we are moving towards the top and the cursor\n // is below the bottom anchor\n (diff < 0 && e.clientY > boundaryElRect.bottom) ||\n // skip if we are moving towards the bottom and the cursor\n // is above the bottom anchor\n (diff > 0 && e.clientY < boundaryElRect.bottom));\n }\n return skipY;\n }\n createResizeMap() {\n const eGui = this.element;\n this.resizerMap = {\n topLeft: { element: eGui.querySelector('[ref=eTopLeftResizer]') },\n top: { element: eGui.querySelector('[ref=eTopResizer]') },\n topRight: { element: eGui.querySelector('[ref=eTopRightResizer]') },\n right: { element: eGui.querySelector('[ref=eRightResizer]') },\n bottomRight: { element: eGui.querySelector('[ref=eBottomRightResizer]') },\n bottom: { element: eGui.querySelector('[ref=eBottomResizer]') },\n bottomLeft: { element: eGui.querySelector('[ref=eBottomLeftResizer]') },\n left: { element: eGui.querySelector('[ref=eLeftResizer]') }\n };\n }\n addResizers() {\n if (this.resizersAdded) {\n return;\n }\n const eGui = this.element;\n if (!eGui) {\n return;\n }\n const parser = new DOMParser();\n const resizers = parser.parseFromString(RESIZE_TEMPLATE, 'text/html').body;\n eGui.appendChild(resizers.firstChild);\n this.createResizeMap();\n this.resizersAdded = true;\n }\n removeResizers() {\n this.resizerMap = undefined;\n const resizerEl = this.element.querySelector(`.${RESIZE_CONTAINER_STYLE}`);\n if (resizerEl) {\n this.element.removeChild(resizerEl);\n }\n this.resizersAdded = false;\n }\n getResizerElement(side) {\n return this.resizerMap[side].element;\n }\n onResizeStart(e, side) {\n this.boundaryEl = this.findBoundaryElement();\n if (!this.positioned) {\n this.initialisePosition();\n }\n this.currentResizer = {\n isTop: !!side.match(/top/i),\n isRight: !!side.match(/right/i),\n isBottom: !!side.match(/bottom/i),\n isLeft: !!side.match(/left/i),\n };\n this.element.classList.add('ag-resizing');\n this.resizerMap[side].element.classList.add('ag-active');\n const { popup, forcePopupParentAsOffsetParent } = this.config;\n if (!popup && !forcePopupParentAsOffsetParent) {\n this.applySizeToSiblings(this.currentResizer.isBottom || this.currentResizer.isTop);\n }\n this.isResizing = true;\n this.updateDragStartPosition(e.clientX, e.clientY);\n }\n getSiblings() {\n const element = this.element;\n const parent = element.parentElement;\n if (!parent) {\n return null;\n }\n return Array.prototype.slice.call(parent.children).filter((el) => !el.classList.contains('ag-hidden'));\n }\n getMinSizeOfSiblings() {\n const siblings = this.getSiblings() || [];\n let height = 0;\n let width = 0;\n for (let i = 0; i < siblings.length; i++) {\n const currentEl = siblings[i];\n const isFlex = !!currentEl.style.flex && currentEl.style.flex !== '0 0 auto';\n if (currentEl === this.element) {\n continue;\n }\n let nextHeight = this.minHeight || 0;\n let nextWidth = this.minWidth || 0;\n if (isFlex) {\n const computedStyle = window.getComputedStyle(currentEl);\n if (computedStyle.minHeight) {\n nextHeight = parseInt(computedStyle.minHeight, 10);\n }\n if (computedStyle.minWidth) {\n nextWidth = parseInt(computedStyle.minWidth, 10);\n }\n }\n else {\n nextHeight = currentEl.offsetHeight;\n nextWidth = currentEl.offsetWidth;\n }\n height += nextHeight;\n width += nextWidth;\n }\n return { height, width };\n }\n applySizeToSiblings(vertical) {\n let containerToFlex = null;\n const siblings = this.getSiblings();\n if (!siblings) {\n return;\n }\n for (let i = 0; i < siblings.length; i++) {\n const el = siblings[i];\n if (el === containerToFlex) {\n continue;\n }\n if (vertical) {\n el.style.height = `${el.offsetHeight}px`;\n }\n else {\n el.style.width = `${el.offsetWidth}px`;\n }\n el.style.flex = '0 0 auto';\n if (el === this.element) {\n containerToFlex = siblings[i + 1];\n }\n }\n if (containerToFlex) {\n containerToFlex.style.removeProperty('height');\n containerToFlex.style.removeProperty('min-height');\n containerToFlex.style.removeProperty('max-height');\n containerToFlex.style.flex = '1 1 auto';\n }\n }\n isResizable() {\n return Object.values(this.resizable).some(value => value);\n }\n onResize(e) {\n if (!this.isResizing || !this.currentResizer) {\n return;\n }\n const { popup, forcePopupParentAsOffsetParent } = this.config;\n const { isTop, isRight, isBottom, isLeft } = this.currentResizer;\n const isHorizontal = isRight || isLeft;\n const isVertical = isBottom || isTop;\n const { movementX, movementY } = this.calculateMouseMovement({ e, isLeft, isTop });\n const xPosition = this.position.x;\n const yPosition = this.position.y;\n let offsetLeft = 0;\n let offsetTop = 0;\n if (isHorizontal && movementX) {\n const direction = isLeft ? -1 : 1;\n const oldWidth = this.getWidth();\n const newWidth = oldWidth + (movementX * direction);\n let skipWidth = false;\n if (isLeft) {\n offsetLeft = oldWidth - newWidth;\n if (xPosition + offsetLeft <= 0 || newWidth <= this.minWidth) {\n skipWidth = true;\n offsetLeft = 0;\n }\n }\n if (!skipWidth) {\n this.setWidth(newWidth);\n }\n }\n if (isVertical && movementY) {\n const direction = isTop ? -1 : 1;\n const oldHeight = this.getHeight();\n const newHeight = oldHeight + (movementY * direction);\n let skipHeight = false;\n if (isTop) {\n offsetTop = oldHeight - newHeight;\n if (yPosition + offsetTop <= 0 || newHeight <= this.minHeight) {\n skipHeight = true;\n offsetTop = 0;\n }\n }\n else {\n // do not let the size of all siblings be higher than the parent container\n if (!this.config.popup &&\n !this.config.forcePopupParentAsOffsetParent &&\n oldHeight < newHeight &&\n (this.getMinSizeOfSiblings().height + newHeight) > this.element.parentElement.offsetHeight) {\n skipHeight = true;\n }\n }\n if (!skipHeight) {\n this.setHeight(newHeight);\n }\n }\n this.updateDragStartPosition(e.clientX, e.clientY);\n if ((popup || forcePopupParentAsOffsetParent) && offsetLeft || offsetTop) {\n this.offsetElement(xPosition + offsetLeft, yPosition + offsetTop);\n }\n }\n onResizeEnd(e, side) {\n this.isResizing = false;\n this.currentResizer = null;\n this.boundaryEl = null;\n const params = {\n type: 'resize',\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi\n };\n this.element.classList.remove('ag-resizing');\n this.resizerMap[side].element.classList.remove('ag-active');\n this.dispatchEvent(params);\n }\n refreshSize() {\n const eGui = this.element;\n if (this.config.popup) {\n if (!this.config.width) {\n this.setWidth(eGui.offsetWidth);\n }\n if (!this.config.height) {\n this.setHeight(eGui.offsetHeight);\n }\n }\n }\n onMoveStart(e) {\n this.boundaryEl = this.findBoundaryElement();\n if (!this.positioned) {\n this.initialisePosition();\n }\n this.isMoving = true;\n this.element.classList.add('ag-moving');\n this.updateDragStartPosition(e.clientX, e.clientY);\n }\n onMove(e) {\n if (!this.isMoving) {\n return;\n }\n const { x, y } = this.position;\n let topBuffer;\n if (this.config.calculateTopBuffer) {\n topBuffer = this.config.calculateTopBuffer();\n }\n const { movementX, movementY } = this.calculateMouseMovement({\n e,\n isTop: true,\n anywhereWithin: true,\n topBuffer\n });\n this.offsetElement(x + movementX, y + movementY);\n this.updateDragStartPosition(e.clientX, e.clientY);\n }\n onMoveEnd() {\n this.isMoving = false;\n this.boundaryEl = null;\n this.element.classList.remove('ag-moving');\n }\n setOffsetParent() {\n if (this.config.forcePopupParentAsOffsetParent) {\n this.offsetParent = this.popupService.getPopupParent();\n }\n else {\n this.offsetParent = this.element.offsetParent;\n }\n }\n findBoundaryElement() {\n let el = this.element;\n while (el) {\n if (window.getComputedStyle(el).position !== 'static') {\n return el;\n }\n el = el.parentElement;\n }\n return this.element;\n }\n clearResizeListeners() {\n while (this.resizeListeners.length) {\n const params = this.resizeListeners.pop();\n this.dragService.removeDragSource(params);\n }\n }\n destroy() {\n super.destroy();\n if (this.moveElementDragListener) {\n this.dragService.removeDragSource(this.moveElementDragListener);\n }\n this.constrainSizeToAvailableHeight(false);\n this.clearResizeListeners();\n this.removeResizers();\n }\n}\n__decorate([\n Autowired('popupService')\n], PositionableFeature.prototype, \"popupService\", void 0);\n__decorate([\n Autowired('resizeObserverService')\n], PositionableFeature.prototype, \"resizeObserverService\", void 0);\n__decorate([\n Autowired('dragService')\n], PositionableFeature.prototype, \"dragService\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from '../../context/context.mjs';\nimport { loadTemplate, setDisabled } from '../../utils/dom.mjs';\nimport { debounce } from '../../utils/function.mjs';\nimport { DEFAULT_FILTER_LOCALE_TEXT } from '../filterLocaleText.mjs';\nimport { ManagedFocusFeature } from '../../widgets/managedFocusFeature.mjs';\nimport { convertToSet } from '../../utils/set.mjs';\nimport { Component } from '../../widgets/component.mjs';\nimport { RefSelector } from '../../widgets/componentAnnotations.mjs';\nimport { PositionableFeature } from '../../rendering/features/positionableFeature.mjs';\n/**\n * Contains common logic to all provided filters (apply button, clear button, etc).\n * All the filters that come with AG Grid extend this class. User filters do not\n * extend this class.\n *\n * @param M type of filter-model managed by the concrete sub-class that extends this type\n * @param V type of value managed by the concrete sub-class that extends this type\n */\nexport class ProvidedFilter extends Component {\n constructor(filterNameKey) {\n super();\n this.filterNameKey = filterNameKey;\n this.applyActive = false;\n this.hidePopup = null;\n this.debouncePending = false;\n // after the user hits 'apply' the model gets copied to here. this is then the model that we use for\n // all filtering. so if user changes UI but doesn't hit apply, then the UI will be out of sync with this model.\n // this is what we want, as the UI should only become the 'active' filter once it's applied. when apply is\n // inactive, this model will be in sync (following the debounce ms). if the UI is not a valid filter\n // (eg the value is missing so nothing to filter on, or for set filter all checkboxes are checked so filter\n // not active) then this appliedModel will be null/undefined.\n this.appliedModel = null;\n }\n postConstruct() {\n this.resetTemplate(); // do this first to create the DOM\n this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), {\n handleKeyDown: this.handleKeyDown.bind(this)\n }));\n this.positionableFeature = new PositionableFeature(this.getPositionableElement(), {\n forcePopupParentAsOffsetParent: true\n });\n this.createBean(this.positionableFeature);\n }\n // override\n handleKeyDown(e) { }\n getFilterTitle() {\n return this.translate(this.filterNameKey);\n }\n isFilterActive() {\n // filter is active if we have a valid applied model\n return !!this.appliedModel;\n }\n resetTemplate(paramsMap) {\n let eGui = this.getGui();\n if (eGui) {\n eGui.removeEventListener('submit', this.onFormSubmit);\n }\n const templateString = /* html */ `\n \n
\n ${this.createBodyTemplate()}\n
\n `;\n this.setTemplate(templateString, paramsMap);\n eGui = this.getGui();\n if (eGui) {\n eGui.addEventListener('submit', this.onFormSubmit);\n }\n }\n isReadOnly() {\n return !!this.providedFilterParams.readOnly;\n }\n init(params) {\n this.setParams(params);\n this.resetUiToDefaults(true).then(() => {\n this.updateUiVisibility();\n this.setupOnBtApplyDebounce();\n });\n }\n setParams(params) {\n this.providedFilterParams = params;\n this.applyActive = ProvidedFilter.isUseApplyButton(params);\n this.createButtonPanel();\n }\n createButtonPanel() {\n const { buttons } = this.providedFilterParams;\n if (!buttons || buttons.length < 1 || this.isReadOnly()) {\n return;\n }\n const eButtonsPanel = document.createElement('div');\n eButtonsPanel.classList.add('ag-filter-apply-panel');\n const addButton = (type) => {\n let text;\n let clickListener;\n switch (type) {\n case 'apply':\n text = this.translate('applyFilter');\n clickListener = (e) => this.onBtApply(false, false, e);\n break;\n case 'clear':\n text = this.translate('clearFilter');\n clickListener = () => this.onBtClear();\n break;\n case 'reset':\n text = this.translate('resetFilter');\n clickListener = () => this.onBtReset();\n break;\n case 'cancel':\n text = this.translate('cancelFilter');\n clickListener = (e) => { this.onBtCancel(e); };\n break;\n default:\n console.warn('AG Grid: Unknown button type specified');\n return;\n }\n const buttonType = type === 'apply' ? 'submit' : 'button';\n const button = loadTemplate(\n /* html */\n `${text}\n `);\n eButtonsPanel.appendChild(button);\n this.addManagedListener(button, 'click', clickListener);\n };\n convertToSet(buttons).forEach(type => addButton(type));\n this.getGui().appendChild(eButtonsPanel);\n }\n // subclasses can override this to provide alternative debounce defaults\n getDefaultDebounceMs() {\n return 0;\n }\n setupOnBtApplyDebounce() {\n const debounceMs = ProvidedFilter.getDebounceMs(this.providedFilterParams, this.getDefaultDebounceMs());\n const debounceFunc = debounce(this.checkApplyDebounce.bind(this), debounceMs);\n this.onBtApplyDebounce = () => {\n this.debouncePending = true;\n debounceFunc();\n };\n }\n checkApplyDebounce() {\n if (this.debouncePending) {\n // May already have been applied, so don't apply again (e.g. closing filter before debounce timeout)\n this.debouncePending = false;\n this.onBtApply();\n }\n }\n getModel() {\n return this.appliedModel ? this.appliedModel : null;\n }\n setModel(model) {\n const promise = model != null ? this.setModelIntoUi(model) : this.resetUiToDefaults();\n return promise.then(() => {\n this.updateUiVisibility();\n // we set the model from the GUI, rather than the provided model,\n // so the model is consistent, e.g. handling of null/undefined will be the same,\n // or if model is case insensitive, then casing is removed.\n this.applyModel('api');\n });\n }\n onBtCancel(e) {\n this.resetUiToActiveModel(this.getModel(), () => {\n this.handleCancelEnd(e);\n });\n }\n handleCancelEnd(e) {\n if (this.providedFilterParams.closeOnApply) {\n this.close(e);\n }\n }\n resetUiToActiveModel(currentModel, afterUiUpdatedFunc) {\n const afterAppliedFunc = () => {\n this.onUiChanged(false, 'prevent');\n afterUiUpdatedFunc === null || afterUiUpdatedFunc === void 0 ? void 0 : afterUiUpdatedFunc();\n };\n if (currentModel != null) {\n this.setModelIntoUi(currentModel).then(afterAppliedFunc);\n }\n else {\n this.resetUiToDefaults().then(afterAppliedFunc);\n }\n }\n onBtClear() {\n this.resetUiToDefaults().then(() => this.onUiChanged());\n }\n onBtReset() {\n this.onBtClear();\n this.onBtApply();\n }\n /**\n * Applies changes made in the UI to the filter, and returns true if the model has changed.\n */\n applyModel(source = 'api') {\n const newModel = this.getModelFromUi();\n if (!this.isModelValid(newModel)) {\n return false;\n }\n const previousModel = this.appliedModel;\n this.appliedModel = newModel;\n // models can be same if user pasted same content into text field, or maybe just changed the case\n // and it's a case insensitive filter\n return !this.areModelsEqual(previousModel, newModel);\n }\n isModelValid(model) {\n return true;\n }\n onFormSubmit(e) {\n e.preventDefault();\n }\n onBtApply(afterFloatingFilter = false, afterDataChange = false, e) {\n // Prevent form submission\n if (e) {\n e.preventDefault();\n }\n if (this.applyModel(afterDataChange ? 'rowDataUpdated' : 'ui')) {\n // the floating filter uses 'afterFloatingFilter' info, so it doesn't refresh after filter changed if change\n // came from floating filter\n const source = 'columnFilter';\n this.providedFilterParams.filterChangedCallback({ afterFloatingFilter, afterDataChange, source });\n }\n const { closeOnApply } = this.providedFilterParams;\n // only close if an apply button is visible, otherwise we'd be closing every time a change was made!\n if (closeOnApply && this.applyActive && !afterFloatingFilter && !afterDataChange) {\n this.close(e);\n }\n }\n onNewRowsLoaded() {\n }\n close(e) {\n if (!this.hidePopup) {\n return;\n }\n const keyboardEvent = e;\n const key = keyboardEvent && keyboardEvent.key;\n let params;\n if (key === 'Enter' || key === 'Space') {\n params = { keyboardEvent };\n }\n this.hidePopup(params);\n this.hidePopup = null;\n }\n /**\n * By default, if the change came from a floating filter it will be applied immediately, otherwise if there is no\n * apply button it will be applied after a debounce, otherwise it will not be applied at all. This behaviour can\n * be adjusted by using the apply parameter.\n */\n onUiChanged(fromFloatingFilter = false, apply) {\n this.updateUiVisibility();\n this.providedFilterParams.filterModifiedCallback();\n if (this.applyActive && !this.isReadOnly()) {\n const isValid = this.isModelValid(this.getModelFromUi());\n setDisabled(this.getRefElement('applyFilterButton'), !isValid);\n }\n if ((fromFloatingFilter && !apply) || apply === 'immediately') {\n this.onBtApply(fromFloatingFilter);\n }\n else if ((!this.applyActive && !apply) || apply === 'debounce') {\n this.onBtApplyDebounce();\n }\n }\n afterGuiAttached(params) {\n if (params) {\n this.hidePopup = params.hidePopup;\n }\n this.refreshFilterResizer(params === null || params === void 0 ? void 0 : params.container);\n }\n refreshFilterResizer(containerType) {\n // tool panel is scrollable, so don't need to size\n if (!this.positionableFeature || containerType === 'toolPanel') {\n return;\n }\n const isFloatingFilter = containerType === 'floatingFilter';\n const { positionableFeature, gridOptionsService } = this;\n if (isFloatingFilter) {\n positionableFeature.restoreLastSize();\n positionableFeature.setResizable(gridOptionsService.is('enableRtl')\n ? { bottom: true, bottomLeft: true, left: true }\n : { bottom: true, bottomRight: true, right: true });\n }\n else {\n this.positionableFeature.removeSizeFromEl();\n this.positionableFeature.setResizable(false);\n }\n this.positionableFeature.constrainSizeToAvailableHeight(true);\n }\n afterGuiDetached() {\n this.checkApplyDebounce();\n if (this.positionableFeature) {\n this.positionableFeature.constrainSizeToAvailableHeight(false);\n }\n }\n // static, as used by floating filter also\n static getDebounceMs(params, debounceDefault) {\n if (ProvidedFilter.isUseApplyButton(params)) {\n if (params.debounceMs != null) {\n console.warn('AG Grid: debounceMs is ignored when apply button is present');\n }\n return 0;\n }\n return params.debounceMs != null ? params.debounceMs : debounceDefault;\n }\n // static, as used by floating filter also\n static isUseApplyButton(params) {\n return !!params.buttons && params.buttons.indexOf('apply') >= 0;\n }\n destroy() {\n const eGui = this.getGui();\n if (eGui) {\n eGui.removeEventListener('submit', this.onFormSubmit);\n }\n this.hidePopup = null;\n if (this.positionableFeature) {\n this.positionableFeature = this.destroyBean(this.positionableFeature);\n }\n super.destroy();\n }\n translate(key) {\n const translate = this.localeService.getLocaleTextFunc();\n return translate(key, DEFAULT_FILTER_LOCALE_TEXT[key]);\n }\n getCellValue(rowNode) {\n const { api, colDef, column, columnApi, context } = this.providedFilterParams;\n return this.providedFilterParams.valueGetter({\n api,\n colDef,\n column,\n columnApi,\n context,\n data: rowNode.data,\n getValue: (field) => rowNode.data[field],\n node: rowNode,\n });\n }\n // override to control positionable feature\n getPositionableElement() {\n return this.eFilterBody;\n }\n}\n__decorate([\n Autowired('rowModel')\n], ProvidedFilter.prototype, \"rowModel\", void 0);\n__decorate([\n RefSelector('eFilterBody')\n], ProvidedFilter.prototype, \"eFilterBody\", void 0);\n__decorate([\n PostConstruct\n], ProvidedFilter.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from \"./component.mjs\";\nimport { PostConstruct } from \"../context/context.mjs\";\nimport { clearElement, setDisabled, setDisplayed, setElementWidth } from \"../utils/dom.mjs\";\nimport { setAriaRole } from \"../utils/aria.mjs\";\nexport class AgAbstractLabel extends Component {\n constructor(config, template) {\n super(template);\n this.labelSeparator = '';\n this.labelAlignment = 'left';\n this.disabled = false;\n this.label = '';\n this.config = config || {};\n }\n postConstruct() {\n this.addCssClass('ag-labeled');\n this.eLabel.classList.add('ag-label');\n const { labelSeparator, label, labelWidth, labelAlignment } = this.config;\n if (labelSeparator != null) {\n this.setLabelSeparator(labelSeparator);\n }\n if (label != null) {\n this.setLabel(label);\n }\n if (labelWidth != null) {\n this.setLabelWidth(labelWidth);\n }\n this.setLabelAlignment(labelAlignment || this.labelAlignment);\n this.refreshLabel();\n }\n refreshLabel() {\n clearElement(this.eLabel);\n if (typeof this.label === 'string') {\n this.eLabel.innerText = this.label + this.labelSeparator;\n }\n else if (this.label) {\n this.eLabel.appendChild(this.label);\n }\n if (this.label === '') {\n setDisplayed(this.eLabel, false);\n setAriaRole(this.eLabel, 'presentation');\n }\n else {\n setDisplayed(this.eLabel, true);\n setAriaRole(this.eLabel, null);\n }\n }\n setLabelSeparator(labelSeparator) {\n if (this.labelSeparator === labelSeparator) {\n return this;\n }\n this.labelSeparator = labelSeparator;\n if (this.label != null) {\n this.refreshLabel();\n }\n return this;\n }\n getLabelId() {\n this.eLabel.id = this.eLabel.id || `ag-${this.getCompId()}-label`;\n return this.eLabel.id;\n }\n getLabel() {\n return this.label;\n }\n setLabel(label) {\n if (this.label === label) {\n return this;\n }\n this.label = label;\n this.refreshLabel();\n return this;\n }\n setLabelAlignment(alignment) {\n const eGui = this.getGui();\n const eGuiClassList = eGui.classList;\n eGuiClassList.toggle('ag-label-align-left', alignment === 'left');\n eGuiClassList.toggle('ag-label-align-right', alignment === 'right');\n eGuiClassList.toggle('ag-label-align-top', alignment === 'top');\n return this;\n }\n setLabelEllipsis(hasEllipsis) {\n this.eLabel.classList.toggle('ag-label-ellipsis', hasEllipsis);\n return this;\n }\n setLabelWidth(width) {\n if (this.label == null) {\n return this;\n }\n setElementWidth(this.eLabel, width);\n return this;\n }\n setDisabled(disabled) {\n disabled = !!disabled;\n const element = this.getGui();\n setDisabled(element, disabled);\n element.classList.toggle('ag-disabled', disabled);\n this.disabled = disabled;\n return this;\n }\n isDisabled() {\n return !!this.disabled;\n }\n}\n__decorate([\n PostConstruct\n], AgAbstractLabel.prototype, \"postConstruct\", null);\n","import { AgAbstractLabel } from './agAbstractLabel.mjs';\nimport { setFixedWidth } from '../utils/dom.mjs';\nimport { Events } from '../eventKeys.mjs';\nexport class AgAbstractField extends AgAbstractLabel {\n constructor(config, template, className) {\n super(config, template);\n this.className = className;\n }\n postConstruct() {\n super.postConstruct();\n if (this.className) {\n this.addCssClass(this.className);\n }\n }\n onValueChange(callbackFn) {\n this.addManagedListener(this, Events.EVENT_FIELD_VALUE_CHANGED, () => callbackFn(this.getValue()));\n return this;\n }\n getWidth() {\n return this.getGui().clientWidth;\n }\n setWidth(width) {\n setFixedWidth(this.getGui(), width);\n return this;\n }\n getPreviousValue() {\n return this.previousValue;\n }\n getValue() {\n return this.value;\n }\n setValue(value, silent) {\n if (this.value === value) {\n return this;\n }\n this.previousValue = this.value;\n this.value = value;\n if (!silent) {\n this.dispatchEvent({ type: Events.EVENT_FIELD_VALUE_CHANGED });\n }\n return this;\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { AgAbstractField } from \"./agAbstractField.mjs\";\nimport { RefSelector } from \"./componentAnnotations.mjs\";\nimport { setAriaLabelledBy, setAriaLabel, setAriaDescribedBy, setAriaExpanded } from \"../utils/aria.mjs\";\nimport { createIconNoSpan } from \"../utils/icon.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nimport { setElementWidth, isVisible, getAbsoluteWidth } from \"../utils/dom.mjs\";\nimport { KeyCode } from '../constants/keyCode.mjs';\nimport { Autowired } from \"../context/context.mjs\";\nexport class AgPickerField extends AgAbstractField {\n constructor(config, className, pickerIcon, ariaRole) {\n super(config, \n /* html */ `
\n
\n
\n
\n
\n
\n
`, className);\n this.pickerIcon = pickerIcon;\n this.isPickerDisplayed = false;\n this.skipClick = false;\n this.pickerGap = 4;\n this.hideCurrentPicker = null;\n this.onPickerFocusIn = this.onPickerFocusIn.bind(this);\n this.onPickerFocusOut = this.onPickerFocusOut.bind(this);\n if ((config === null || config === void 0 ? void 0 : config.pickerGap) != null) {\n this.pickerGap = config.pickerGap;\n }\n }\n postConstruct() {\n super.postConstruct();\n const displayId = `ag-${this.getCompId()}-display`;\n this.eDisplayField.setAttribute('id', displayId);\n setAriaDescribedBy(this.eWrapper, displayId);\n const eGui = this.getGui();\n this.addManagedListener(eGui, 'mousedown', (e) => {\n var _a;\n if (!this.skipClick &&\n ((_a = this.pickerComponent) === null || _a === void 0 ? void 0 : _a.isAlive()) &&\n isVisible(this.pickerComponent.getGui()) &&\n eGui.contains(e.target)) {\n this.skipClick = true;\n }\n });\n const focusEl = this.getFocusableElement();\n this.addManagedListener(eGui, 'keydown', this.onKeyDown.bind(this));\n this.addManagedListener(this.eLabel, 'click', this.clickHandler.bind(this));\n this.addManagedListener(focusEl, 'click', this.clickHandler.bind(this));\n if (this.pickerIcon) {\n const icon = createIconNoSpan(this.pickerIcon, this.gridOptionsService);\n if (icon) {\n this.eIcon.appendChild(icon);\n }\n }\n }\n refreshLabel() {\n if (exists(this.getLabel())) {\n setAriaLabelledBy(this.eWrapper, this.getLabelId());\n }\n else {\n this.eWrapper.removeAttribute('aria-labelledby');\n }\n super.refreshLabel();\n }\n clickHandler() {\n if (this.skipClick) {\n this.skipClick = false;\n return;\n }\n if (this.isDisabled()) {\n return;\n }\n this.showPicker();\n }\n onKeyDown(e) {\n switch (e.key) {\n case KeyCode.UP:\n case KeyCode.DOWN:\n case KeyCode.ENTER:\n case KeyCode.SPACE:\n e.preventDefault();\n this.clickHandler();\n break;\n case KeyCode.ESCAPE:\n if (this.isPickerDisplayed) {\n e.preventDefault();\n e.stopPropagation();\n if (this.hideCurrentPicker) {\n this.hideCurrentPicker();\n }\n }\n break;\n }\n }\n showPicker() {\n this.isPickerDisplayed = true;\n if (!this.pickerComponent) {\n this.pickerComponent = this.createPickerComponent();\n }\n const pickerGui = this.pickerComponent.getGui();\n pickerGui.addEventListener('focusin', this.onPickerFocusIn);\n pickerGui.addEventListener('focusout', this.onPickerFocusOut);\n this.hideCurrentPicker = this.renderAndPositionPicker();\n this.toggleExpandedStyles(true);\n }\n renderAndPositionPicker() {\n const eDocument = this.gridOptionsService.getDocument();\n const ePicker = this.pickerComponent.getGui();\n if (!this.gridOptionsService.is('suppressScrollWhenPopupsAreOpen')) {\n this.destroyMouseWheelFunc = this.addManagedListener(eDocument.body, 'wheel', (e) => {\n if (!ePicker.contains(e.target)) {\n this.hidePicker();\n }\n });\n }\n const translate = this.localeService.getLocaleTextFunc();\n const { pickerType, pickerAriaLabelKey, pickerAriaLabelValue } = this.config;\n const popupParams = {\n modal: true,\n eChild: ePicker,\n closeOnEsc: true,\n closedCallback: () => {\n const shouldRestoreFocus = eDocument.activeElement === eDocument.body;\n this.beforeHidePicker();\n if (shouldRestoreFocus && this.isAlive()) {\n this.getFocusableElement().focus();\n }\n },\n ariaLabel: translate(pickerAriaLabelKey, pickerAriaLabelValue),\n };\n const addPopupRes = this.popupService.addPopup(popupParams);\n setElementWidth(ePicker, getAbsoluteWidth(this.eWrapper));\n ePicker.style.position = 'absolute';\n this.popupService.positionPopupByComponent({\n type: pickerType,\n eventSource: this.eWrapper,\n ePopup: ePicker,\n position: 'under',\n keepWithinBounds: true,\n nudgeY: this.pickerGap\n });\n return addPopupRes.hideFunc;\n }\n beforeHidePicker() {\n if (this.destroyMouseWheelFunc) {\n this.destroyMouseWheelFunc();\n this.destroyMouseWheelFunc = undefined;\n }\n this.toggleExpandedStyles(false);\n const pickerGui = this.pickerComponent.getGui();\n pickerGui.removeEventListener('focusin', this.onPickerFocusIn);\n pickerGui.removeEventListener('focusout', this.onPickerFocusOut);\n this.isPickerDisplayed = false;\n this.pickerComponent = undefined;\n this.hideCurrentPicker = null;\n }\n toggleExpandedStyles(expanded) {\n if (!this.isAlive()) {\n return;\n }\n setAriaExpanded(this.eWrapper, expanded);\n this.eWrapper.classList.toggle('ag-picker-expanded', expanded);\n this.eWrapper.classList.toggle('ag-picker-collapsed', !expanded);\n }\n onPickerFocusIn() {\n this.togglePickerHasFocus(true);\n }\n onPickerFocusOut(e) {\n var _a;\n if (!((_a = this.pickerComponent) === null || _a === void 0 ? void 0 : _a.getGui().contains(e.relatedTarget))) {\n this.togglePickerHasFocus(false);\n }\n }\n togglePickerHasFocus(focused) {\n if (!this.pickerComponent) {\n return;\n }\n this.eWrapper.classList.toggle('ag-picker-has-focus', focused);\n }\n hidePicker() {\n if (this.hideCurrentPicker) {\n this.hideCurrentPicker();\n }\n }\n setAriaLabel(label) {\n setAriaLabel(this.eWrapper, label);\n return this;\n }\n setInputWidth(width) {\n setElementWidth(this.eWrapper, width);\n return this;\n }\n getFocusableElement() {\n return this.eWrapper;\n }\n setPickerGap(gap) {\n this.pickerGap = gap;\n return this;\n }\n destroy() {\n this.hidePicker();\n super.destroy();\n }\n}\n__decorate([\n Autowired('popupService')\n], AgPickerField.prototype, \"popupService\", void 0);\n__decorate([\n RefSelector('eLabel')\n], AgPickerField.prototype, \"eLabel\", void 0);\n__decorate([\n RefSelector('eWrapper')\n], AgPickerField.prototype, \"eWrapper\", void 0);\n__decorate([\n RefSelector('eDisplayField')\n], AgPickerField.prototype, \"eDisplayField\", void 0);\n__decorate([\n RefSelector('eIcon')\n], AgPickerField.prototype, \"eIcon\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from \"./component.mjs\";\nimport { PostConstruct } from \"../context/context.mjs\";\nimport { escapeString } from \"../utils/string.mjs\";\nimport { KeyCode } from '../constants/keyCode.mjs';\nimport { setAriaPosInSet, setAriaRole, setAriaSelected, setAriaSetSize } from '../utils/aria.mjs';\nimport { Events } from \"../eventKeys.mjs\";\nexport class AgList extends Component {\n constructor(cssIdentifier = 'default') {\n super(/* html */ `
`);\n this.cssIdentifier = cssIdentifier;\n this.options = [];\n this.itemEls = [];\n }\n init() {\n this.addManagedListener(this.getGui(), 'keydown', this.handleKeyDown.bind(this));\n }\n handleKeyDown(e) {\n const key = e.key;\n switch (key) {\n case KeyCode.ENTER:\n if (!this.highlightedEl) {\n this.setValue(this.getValue());\n }\n else {\n const pos = this.itemEls.indexOf(this.highlightedEl);\n this.setValueByIndex(pos);\n }\n break;\n case KeyCode.DOWN:\n case KeyCode.UP:\n const isDown = key === KeyCode.DOWN;\n let itemToHighlight;\n e.preventDefault();\n if (!this.highlightedEl) {\n itemToHighlight = this.itemEls[isDown ? 0 : this.itemEls.length - 1];\n }\n else {\n const currentIdx = this.itemEls.indexOf(this.highlightedEl);\n let nextPos = currentIdx + (isDown ? 1 : -1);\n nextPos = Math.min(Math.max(nextPos, 0), this.itemEls.length - 1);\n itemToHighlight = this.itemEls[nextPos];\n }\n this.highlightItem(itemToHighlight);\n break;\n }\n }\n addOptions(listOptions) {\n listOptions.forEach(listOption => this.addOption(listOption));\n return this;\n }\n addOption(listOption) {\n const { value, text } = listOption;\n const sanitisedText = escapeString(text || value);\n this.options.push({ value, text: sanitisedText });\n this.renderOption(value, sanitisedText);\n this.updateIndices();\n return this;\n }\n updateIndices() {\n const options = this.getGui().querySelectorAll('.ag-list-item');\n options.forEach((option, idx) => {\n setAriaPosInSet(option, idx + 1);\n setAriaSetSize(option, options.length);\n });\n }\n renderOption(value, text) {\n const itemEl = document.createElement('div');\n setAriaRole(itemEl, 'option');\n itemEl.classList.add('ag-list-item', `ag-${this.cssIdentifier}-list-item`);\n itemEl.innerHTML = `${text}`;\n itemEl.tabIndex = -1;\n this.itemEls.push(itemEl);\n this.addManagedListener(itemEl, 'mouseover', () => this.highlightItem(itemEl));\n this.addManagedListener(itemEl, 'mouseleave', () => this.clearHighlighted());\n this.addManagedListener(itemEl, 'click', () => this.setValue(value));\n this.getGui().appendChild(itemEl);\n }\n setValue(value, silent) {\n if (this.value === value) {\n this.fireItemSelected();\n return this;\n }\n if (value == null) {\n this.reset();\n return this;\n }\n const idx = this.options.findIndex(option => option.value === value);\n if (idx !== -1) {\n const option = this.options[idx];\n this.value = option.value;\n this.displayValue = option.text != null ? option.text : option.value;\n this.highlightItem(this.itemEls[idx]);\n if (!silent) {\n this.fireChangeEvent();\n }\n }\n return this;\n }\n setValueByIndex(idx) {\n return this.setValue(this.options[idx].value);\n }\n getValue() {\n return this.value;\n }\n getDisplayValue() {\n return this.displayValue;\n }\n refreshHighlighted() {\n this.clearHighlighted();\n const idx = this.options.findIndex(option => option.value === this.value);\n if (idx !== -1) {\n this.highlightItem(this.itemEls[idx]);\n }\n }\n reset() {\n this.value = null;\n this.displayValue = null;\n this.clearHighlighted();\n this.fireChangeEvent();\n }\n highlightItem(el) {\n if (!el.offsetParent) {\n return;\n }\n this.clearHighlighted();\n this.highlightedEl = el;\n this.highlightedEl.classList.add(AgList.ACTIVE_CLASS);\n setAriaSelected(this.highlightedEl, true);\n this.highlightedEl.focus();\n }\n clearHighlighted() {\n if (!this.highlightedEl || !this.highlightedEl.offsetParent) {\n return;\n }\n this.highlightedEl.classList.remove(AgList.ACTIVE_CLASS);\n setAriaSelected(this.highlightedEl, false);\n this.highlightedEl = null;\n }\n fireChangeEvent() {\n this.dispatchEvent({ type: Events.EVENT_FIELD_VALUE_CHANGED });\n this.fireItemSelected();\n }\n fireItemSelected() {\n this.dispatchEvent({ type: AgList.EVENT_ITEM_SELECTED });\n }\n}\nAgList.EVENT_ITEM_SELECTED = 'selectedItem';\nAgList.ACTIVE_CLASS = 'ag-active-item';\n__decorate([\n PostConstruct\n], AgList.prototype, \"init\", null);\n","import { AgPickerField } from \"./agPickerField.mjs\";\nimport { AgList } from \"./agList.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { KeyCode } from \"../constants/keyCode.mjs\";\nimport { getInnerHeight } from \"../utils/dom.mjs\";\nexport class AgSelect extends AgPickerField {\n constructor(config) {\n super(Object.assign({ pickerAriaLabelKey: 'ariaLabelSelectField', pickerAriaLabelValue: 'Select Field', pickerType: 'ag-list' }, config), 'ag-select', 'smallDown', 'listbox');\n }\n postConstruct() {\n var _a;\n super.postConstruct();\n this.createListComponent();\n this.eWrapper.tabIndex = (_a = this.gridOptionsService.getNum('tabIndex')) !== null && _a !== void 0 ? _a : 0;\n }\n createListComponent() {\n this.listComponent = this.createBean(new AgList('select'));\n this.listComponent.setParentComponent(this);\n this.listComponent.addGuiEventListener('keydown', (e) => {\n if (e.key === KeyCode.TAB) {\n e.preventDefault();\n e.stopImmediatePropagation();\n this.getGui().dispatchEvent(new KeyboardEvent('keydown', {\n key: e.key,\n shiftKey: e.shiftKey,\n ctrlKey: e.ctrlKey,\n bubbles: true\n }));\n }\n ;\n });\n this.listComponent.addManagedListener(this.listComponent, AgList.EVENT_ITEM_SELECTED, () => {\n this.hidePicker();\n this.dispatchEvent({ type: AgSelect.EVENT_ITEM_SELECTED });\n });\n this.listComponent.addManagedListener(this.listComponent, Events.EVENT_FIELD_VALUE_CHANGED, () => {\n if (!this.listComponent) {\n return;\n }\n this.setValue(this.listComponent.getValue(), false, true);\n this.hidePicker();\n });\n }\n createPickerComponent() {\n // do not create the picker every time to save state\n return this.listComponent;\n }\n showPicker() {\n if (!this.listComponent) {\n return;\n }\n super.showPicker();\n this.listComponent.getGui().style.maxHeight = `${getInnerHeight(this.popupService.getPopupParent())}px`;\n const ePicker = this.listComponent.getGui();\n this.pickerFocusOutListener = this.addManagedListener(ePicker, 'focusout', (e) => {\n if (!ePicker.contains(e.relatedTarget)) {\n this.hidePicker();\n }\n });\n this.listComponent.refreshHighlighted();\n }\n beforeHidePicker() {\n if (this.pickerFocusOutListener) {\n this.pickerFocusOutListener();\n this.pickerFocusOutListener = undefined;\n }\n super.beforeHidePicker();\n }\n addOptions(options) {\n options.forEach(option => this.addOption(option));\n return this;\n }\n addOption(option) {\n this.listComponent.addOption(option);\n return this;\n }\n setValue(value, silent, fromPicker) {\n if (this.value === value || !this.listComponent) {\n return this;\n }\n if (!fromPicker) {\n this.listComponent.setValue(value, true);\n }\n const newValue = this.listComponent.getValue();\n if (newValue === this.getValue()) {\n return this;\n }\n this.eDisplayField.innerHTML = this.listComponent.getDisplayValue();\n return super.setValue(value, silent);\n }\n destroy() {\n if (this.listComponent) {\n this.destroyBean(this.listComponent);\n this.listComponent = undefined;\n }\n super.destroy();\n }\n}\nAgSelect.EVENT_ITEM_SELECTED = 'selectedItem';\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { RefSelector } from './componentAnnotations.mjs';\nimport { AgAbstractField } from './agAbstractField.mjs';\nimport { setDisabled, setElementWidth, addOrRemoveAttribute } from '../utils/dom.mjs';\nimport { setAriaLabelledBy, setAriaLabel } from '../utils/aria.mjs';\nimport { exists } from '../utils/generic.mjs';\nexport class AgAbstractInputField extends AgAbstractField {\n constructor(config, className, inputType = 'text', displayFieldTag = 'input') {\n super(config, /* html */ `\n
\n
\n
\n <${displayFieldTag} ref=\"eInput\" class=\"ag-input-field-input\">\n
\n
`, className);\n this.inputType = inputType;\n this.displayFieldTag = displayFieldTag;\n }\n postConstruct() {\n super.postConstruct();\n this.setInputType();\n this.eLabel.classList.add(`${this.className}-label`);\n this.eWrapper.classList.add(`${this.className}-input-wrapper`);\n this.eInput.classList.add(`${this.className}-input`);\n this.addCssClass('ag-input-field');\n this.eInput.id = this.eInput.id || `ag-${this.getCompId()}-input`;\n const { width, value } = this.config;\n if (width != null) {\n this.setWidth(width);\n }\n if (value != null) {\n this.setValue(value);\n }\n this.addInputListeners();\n this.activateTabIndex([this.eInput]);\n }\n refreshLabel() {\n if (exists(this.getLabel())) {\n setAriaLabelledBy(this.eInput, this.getLabelId());\n }\n else {\n this.eInput.removeAttribute('aria-labelledby');\n }\n super.refreshLabel();\n }\n addInputListeners() {\n this.addManagedListener(this.eInput, 'input', e => this.setValue(e.target.value));\n }\n setInputType() {\n if (this.displayFieldTag === 'input') {\n this.eInput.setAttribute('type', this.inputType);\n }\n }\n getInputElement() {\n return this.eInput;\n }\n setInputWidth(width) {\n setElementWidth(this.eWrapper, width);\n return this;\n }\n setInputName(name) {\n this.getInputElement().setAttribute('name', name);\n return this;\n }\n getFocusableElement() {\n return this.eInput;\n }\n setMaxLength(length) {\n const eInput = this.eInput;\n eInput.maxLength = length;\n return this;\n }\n setInputPlaceholder(placeholder) {\n addOrRemoveAttribute(this.eInput, 'placeholder', placeholder);\n return this;\n }\n setInputAriaLabel(label) {\n setAriaLabel(this.eInput, label);\n return this;\n }\n setDisabled(disabled) {\n setDisabled(this.eInput, disabled);\n return super.setDisabled(disabled);\n }\n setAutoComplete(value) {\n if (value === true) {\n // Remove the autocomplete attribute if the value is explicitly set to true\n // to allow the default browser autocomplete/autofill behaviour.\n addOrRemoveAttribute(this.eInput, 'autocomplete', null);\n }\n else {\n // When a string is provided, use it as the value of the autocomplete attribute.\n // This enables users to specify how they want to the browser to handle the autocomplete on the input, as per spec:\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values\n const autoCompleteValue = typeof value === 'string' ? value : 'off';\n addOrRemoveAttribute(this.eInput, 'autocomplete', autoCompleteValue);\n }\n return this;\n }\n}\n__decorate([\n RefSelector('eLabel')\n], AgAbstractInputField.prototype, \"eLabel\", void 0);\n__decorate([\n RefSelector('eWrapper')\n], AgAbstractInputField.prototype, \"eWrapper\", void 0);\n__decorate([\n RefSelector('eInput')\n], AgAbstractInputField.prototype, \"eInput\", void 0);\n","import { Events } from \"../events.mjs\";\nimport { AgAbstractInputField } from './agAbstractInputField.mjs';\nexport class AgCheckbox extends AgAbstractInputField {\n constructor(config, className = 'ag-checkbox', inputType = 'checkbox') {\n super(config, className, inputType);\n this.labelAlignment = 'right';\n this.selected = false;\n this.readOnly = false;\n this.passive = false;\n }\n addInputListeners() {\n this.addManagedListener(this.eInput, 'click', this.onCheckboxClick.bind(this));\n this.addManagedListener(this.eLabel, 'click', this.toggle.bind(this));\n }\n getNextValue() {\n return this.selected === undefined ? true : !this.selected;\n }\n setPassive(passive) {\n this.passive = passive;\n }\n isReadOnly() {\n return this.readOnly;\n }\n setReadOnly(readOnly) {\n this.eWrapper.classList.toggle('ag-disabled', readOnly);\n this.eInput.disabled = readOnly;\n this.readOnly = readOnly;\n }\n setDisabled(disabled) {\n this.eWrapper.classList.toggle('ag-disabled', disabled);\n return super.setDisabled(disabled);\n }\n toggle() {\n if (this.eInput.disabled) {\n return;\n }\n const previousValue = this.isSelected();\n const nextValue = this.getNextValue();\n if (this.passive) {\n this.dispatchChange(nextValue, previousValue);\n }\n else {\n this.setValue(nextValue);\n }\n }\n getValue() {\n return this.isSelected();\n }\n setValue(value, silent) {\n this.refreshSelectedClass(value);\n this.setSelected(value, silent);\n return this;\n }\n setName(name) {\n const input = this.getInputElement();\n input.name = name;\n return this;\n }\n isSelected() {\n return this.selected;\n }\n setSelected(selected, silent) {\n if (this.isSelected() === selected) {\n return;\n }\n this.previousValue = this.isSelected();\n selected = this.selected = typeof selected === 'boolean' ? selected : undefined;\n this.eInput.checked = selected;\n this.eInput.indeterminate = selected === undefined;\n if (!silent) {\n this.dispatchChange(this.selected, this.previousValue);\n }\n }\n dispatchChange(selected, previousValue, event) {\n this.dispatchEvent({ type: Events.EVENT_FIELD_VALUE_CHANGED, selected, previousValue, event });\n const input = this.getInputElement();\n const checkboxChangedEvent = {\n type: Events.EVENT_CHECKBOX_CHANGED,\n id: input.id,\n name: input.name,\n selected,\n previousValue\n };\n this.eventService.dispatchEvent(checkboxChangedEvent);\n }\n onCheckboxClick(e) {\n if (this.passive || this.eInput.disabled) {\n return;\n }\n const previousValue = this.isSelected();\n const selected = this.selected = e.target.checked;\n this.refreshSelectedClass(selected);\n this.dispatchChange(selected, previousValue, e);\n }\n refreshSelectedClass(value) {\n this.eWrapper.classList.toggle('ag-checked', value === true);\n this.eWrapper.classList.toggle('ag-indeterminate', value == null);\n }\n}\n","import { AgCheckbox } from './agCheckbox.mjs';\nimport { Events } from '../eventKeys.mjs';\nexport class AgRadioButton extends AgCheckbox {\n constructor(config) {\n super(config, 'ag-radio-button', 'radio');\n }\n isSelected() {\n return this.eInput.checked;\n }\n toggle() {\n if (this.eInput.disabled) {\n return;\n }\n // do not allow an active radio button to be deselected\n if (!this.isSelected()) {\n this.setValue(true);\n }\n }\n addInputListeners() {\n super.addInputListeners();\n this.addManagedListener(this.eventService, Events.EVENT_CHECKBOX_CHANGED, this.onChange.bind(this));\n }\n /**\n * This ensures that if another radio button in the same named group is selected, we deselect this radio button.\n * By default the browser does this for you, but we are managing classes ourselves in order to ensure input\n * elements are styled correctly in IE11, and the DOM 'changed' event is only fired when a button is selected,\n * not deselected, so we need to use our own event.\n */\n onChange(event) {\n if (event.selected &&\n event.name &&\n this.eInput.name &&\n this.eInput.name === event.name &&\n event.id &&\n this.eInput.id !== event.id) {\n this.setValue(false, true);\n }\n }\n}\n","import { OptionsFactory } from './optionsFactory.mjs';\nimport { ProvidedFilter } from './providedFilter.mjs';\nimport { AgPromise } from '../../utils/index.mjs';\nimport { AgSelect } from '../../widgets/agSelect.mjs';\nimport { AgRadioButton } from '../../widgets/agRadioButton.mjs';\nimport { areEqual } from '../../utils/array.mjs';\nimport { setDisplayed, setDisabled, removeFromParent } from '../../utils/dom.mjs';\nimport { DEFAULT_FILTER_LOCALE_TEXT } from '../filterLocaleText.mjs';\nimport { Component } from '../../widgets/component.mjs';\nimport { AgAbstractInputField } from '../../widgets/agAbstractInputField.mjs';\nimport { doOnce, isFunction } from '../../utils/function.mjs';\nexport class SimpleFilterModelFormatter {\n constructor(localeService, optionsFactory, valueFormatter) {\n this.localeService = localeService;\n this.optionsFactory = optionsFactory;\n this.valueFormatter = valueFormatter;\n }\n // used by:\n // 1) NumberFloatingFilter & TextFloatingFilter: Always, for both when editable and read only.\n // 2) DateFloatingFilter: Only when read only (as we show text rather than a date picker when read only)\n getModelAsString(model) {\n if (!model) {\n return null;\n }\n const isCombined = model.operator != null;\n const translate = this.localeService.getLocaleTextFunc();\n if (isCombined) {\n const combinedModel = model;\n let { conditions } = combinedModel;\n if (!conditions) {\n const { condition1, condition2 } = combinedModel;\n conditions = [condition1, condition2];\n }\n const customOptions = conditions.map(condition => this.getModelAsString(condition));\n const joinOperatorTranslateKey = combinedModel.operator === 'AND' ? 'andCondition' : 'orCondition';\n return customOptions.join(` ${translate(joinOperatorTranslateKey, DEFAULT_FILTER_LOCALE_TEXT[joinOperatorTranslateKey])} `);\n }\n else if (model.type === SimpleFilter.BLANK || model.type === SimpleFilter.NOT_BLANK) {\n return translate(model.type, model.type);\n }\n else {\n const condition = model;\n const customOption = this.optionsFactory.getCustomOption(condition.type);\n // For custom filter options we display the Name of the filter instead\n // of displaying the `from` value, as it wouldn't be relevant\n const { displayKey, displayName, numberOfInputs } = customOption || {};\n if (displayKey && displayName && numberOfInputs === 0) {\n translate(displayKey, displayName);\n return displayName;\n }\n return this.conditionToString(condition, customOption);\n }\n }\n updateParams(params) {\n this.optionsFactory = params.optionsFactory;\n }\n formatValue(value) {\n var _a;\n return this.valueFormatter ? ((_a = this.valueFormatter(value !== null && value !== void 0 ? value : null)) !== null && _a !== void 0 ? _a : '') : String(value);\n }\n}\n/**\n * Every filter with a dropdown where the user can specify a comparing type against the filter values.\n *\n * @param M type of filter-model managed by the concrete sub-class that extends this type\n * @param V type of value managed by the concrete sub-class that extends this type\n * @param E type of UI element used for collecting user-input\n */\nexport class SimpleFilter extends ProvidedFilter {\n constructor() {\n super(...arguments);\n this.eTypes = [];\n this.eJoinOperatorPanels = [];\n this.eJoinOperatorsAnd = [];\n this.eJoinOperatorsOr = [];\n this.eConditionBodies = [];\n this.listener = () => this.onUiChanged();\n this.lastUiCompletePosition = null;\n this.joinOperatorId = 0;\n }\n getNumberOfInputs(type) {\n const customOpts = this.optionsFactory.getCustomOption(type);\n if (customOpts) {\n const { numberOfInputs } = customOpts;\n return numberOfInputs != null ? numberOfInputs : 1;\n }\n const zeroInputTypes = [\n SimpleFilter.EMPTY, SimpleFilter.NOT_BLANK, SimpleFilter.BLANK,\n ];\n if (type && zeroInputTypes.indexOf(type) >= 0) {\n return 0;\n }\n else if (type === SimpleFilter.IN_RANGE) {\n return 2;\n }\n return 1;\n }\n // floating filter calls this when user applies filter from floating filter\n onFloatingFilterChanged(type, value) {\n this.setTypeFromFloatingFilter(type);\n this.setValueFromFloatingFilter(value);\n this.onUiChanged(true);\n }\n setTypeFromFloatingFilter(type) {\n this.eTypes.forEach((eType, position) => {\n if (position === 0) {\n eType.setValue(type, true);\n }\n else {\n eType.setValue(this.optionsFactory.getDefaultOption(), true);\n }\n });\n }\n getModelFromUi() {\n const conditions = this.getUiCompleteConditions();\n if (conditions.length === 0) {\n return null;\n }\n if (this.maxNumConditions > 1 && conditions.length > 1) {\n return {\n filterType: this.getFilterType(),\n operator: this.getJoinOperator(),\n condition1: conditions[0],\n condition2: conditions[1],\n conditions\n };\n }\n return conditions[0];\n }\n getConditionTypes() {\n return this.eTypes.map(eType => eType.getValue());\n }\n getConditionType(position) {\n return this.eTypes[position].getValue();\n }\n getJoinOperator() {\n if (this.eJoinOperatorsOr.length === 0) {\n return this.defaultJoinOperator;\n }\n return this.eJoinOperatorsOr[0].getValue() === true ? 'OR' : 'AND';\n }\n areModelsEqual(a, b) {\n // both are missing\n if (!a && !b) {\n return true;\n }\n // one is missing, other present\n if ((!a && b) || (a && !b)) {\n return false;\n }\n // one is combined, the other is not\n const aIsSimple = !a.operator;\n const bIsSimple = !b.operator;\n const oneSimpleOneCombined = (!aIsSimple && bIsSimple) || (aIsSimple && !bIsSimple);\n if (oneSimpleOneCombined) {\n return false;\n }\n let res;\n // otherwise both present, so compare\n if (aIsSimple) {\n const aSimple = a;\n const bSimple = b;\n res = this.areSimpleModelsEqual(aSimple, bSimple);\n }\n else {\n const aCombined = a;\n const bCombined = b;\n res = aCombined.operator === bCombined.operator\n && areEqual(aCombined.conditions, bCombined.conditions, (aModel, bModel) => this.areSimpleModelsEqual(aModel, bModel));\n }\n return res;\n }\n setModelIntoUi(model) {\n const isCombined = model.operator;\n if (isCombined) {\n let combinedModel = model;\n if (!combinedModel.conditions) {\n combinedModel.conditions = [\n combinedModel.condition1,\n combinedModel.condition2\n ];\n }\n const numConditions = this.validateAndUpdateConditions(combinedModel.conditions);\n const numPrevConditions = this.getNumConditions();\n if (numConditions < numPrevConditions) {\n this.removeConditionsAndOperators(numConditions);\n }\n else if (numConditions > numPrevConditions) {\n for (let i = numPrevConditions; i < numConditions; i++) {\n this.createJoinOperatorPanel();\n this.createOption();\n }\n }\n const orChecked = combinedModel.operator === 'OR';\n this.eJoinOperatorsAnd.forEach(eJoinOperatorAnd => eJoinOperatorAnd.setValue(!orChecked, true));\n this.eJoinOperatorsOr.forEach(eJoinOperatorOr => eJoinOperatorOr.setValue(orChecked, true));\n combinedModel.conditions.forEach((condition, position) => {\n this.eTypes[position].setValue(condition.type, true);\n this.setConditionIntoUi(condition, position);\n });\n }\n else {\n const simpleModel = model;\n if (this.getNumConditions() > 1) {\n this.removeConditionsAndOperators(1);\n }\n this.eTypes[0].setValue(simpleModel.type, true);\n this.setConditionIntoUi(simpleModel, 0);\n }\n this.lastUiCompletePosition = this.getNumConditions() - 1;\n this.createMissingConditionsAndOperators();\n this.onUiChanged();\n return AgPromise.resolve();\n }\n validateAndUpdateConditions(conditions) {\n let numConditions = conditions.length;\n if (numConditions > this.maxNumConditions) {\n conditions.splice(this.maxNumConditions);\n doOnce(() => console.warn('AG Grid: Filter Model contains more conditions than \"filterParams.maxNumConditions\". Additional conditions have been ignored.'), 'simpleFilterSetModelMaxNumConditions');\n numConditions = this.maxNumConditions;\n }\n return numConditions;\n }\n doesFilterPass(params) {\n var _a;\n const model = this.getModel();\n if (model == null) {\n return true;\n }\n const { operator } = model;\n const models = [];\n if (operator) {\n const combinedModel = model;\n models.push(...((_a = combinedModel.conditions) !== null && _a !== void 0 ? _a : []));\n }\n else {\n models.push(model);\n }\n const combineFunction = operator && operator === 'OR' ? 'some' : 'every';\n return models[combineFunction](m => this.individualConditionPasses(params, m));\n }\n setParams(params) {\n super.setParams(params);\n this.setNumConditions(params);\n this.defaultJoinOperator = this.getDefaultJoinOperator(params.defaultJoinOperator);\n this.filterPlaceholder = params.filterPlaceholder;\n this.optionsFactory = new OptionsFactory();\n this.optionsFactory.init(params, this.getDefaultFilterOptions());\n this.createFilterListOptions();\n this.createOption();\n this.createMissingConditionsAndOperators();\n if (this.isReadOnly()) {\n // only do this when read only (so no other focusable elements), otherwise the tab order breaks\n // as the tabbed layout managed focus feature will focus the body when it shouldn't\n this.eFilterBody.setAttribute('tabindex', '-1');\n }\n }\n setNumConditions(params) {\n var _a, _b;\n if (params.suppressAndOrCondition != null) {\n doOnce(() => console.warn('AG Grid: Since v29.2 \"filterParams.suppressAndOrCondition\" is deprecated. Use \"filterParams.maxNumConditions = 1\" instead.'), 'simpleFilterSuppressAndOrCondition');\n }\n if (params.alwaysShowBothConditions != null) {\n doOnce(() => console.warn('AG Grid: Since v29.2 \"filterParams.alwaysShowBothConditions\" is deprecated. Use \"filterParams.numAlwaysVisibleConditions = 2\" instead.'), 'simpleFilterAlwaysShowBothConditions');\n }\n this.maxNumConditions = (_a = params.maxNumConditions) !== null && _a !== void 0 ? _a : (params.suppressAndOrCondition ? 1 : 2);\n if (this.maxNumConditions < 1) {\n doOnce(() => console.warn('AG Grid: \"filterParams.maxNumConditions\" must be greater than or equal to zero.'), 'simpleFilterMaxNumConditions');\n this.maxNumConditions = 1;\n }\n this.numAlwaysVisibleConditions = (_b = params.numAlwaysVisibleConditions) !== null && _b !== void 0 ? _b : (params.alwaysShowBothConditions ? 2 : 1);\n if (this.numAlwaysVisibleConditions < 1) {\n doOnce(() => console.warn('AG Grid: \"filterParams.numAlwaysVisibleConditions\" must be greater than or equal to zero.'), 'simpleFilterNumAlwaysVisibleConditions');\n this.numAlwaysVisibleConditions = 1;\n }\n if (this.numAlwaysVisibleConditions > this.maxNumConditions) {\n doOnce(() => console.warn('AG Grid: \"filterParams.numAlwaysVisibleConditions\" cannot be greater than \"filterParams.maxNumConditions\".'), 'simpleFilterNumAlwaysVisibleGreaterThanMaxNumConditions');\n this.numAlwaysVisibleConditions = this.maxNumConditions;\n }\n }\n createOption() {\n const eType = this.createManagedBean(new AgSelect());\n this.eTypes.push(eType);\n eType.addCssClass('ag-filter-select');\n this.eFilterBody.appendChild(eType.getGui());\n const eConditionBody = this.createValueElement();\n this.eConditionBodies.push(eConditionBody);\n this.eFilterBody.appendChild(eConditionBody);\n this.putOptionsIntoDropdown(eType);\n this.resetType(eType);\n const position = this.getNumConditions() - 1;\n this.forEachPositionInput(position, (element) => this.resetInput(element));\n this.addChangedListeners(eType, position);\n }\n createJoinOperatorPanel() {\n const eJoinOperatorPanel = document.createElement('div');\n this.eJoinOperatorPanels.push(eJoinOperatorPanel);\n eJoinOperatorPanel.classList.add('ag-filter-condition');\n const eJoinOperatorAnd = this.createJoinOperator(this.eJoinOperatorsAnd, eJoinOperatorPanel, 'and');\n const eJoinOperatorOr = this.createJoinOperator(this.eJoinOperatorsOr, eJoinOperatorPanel, 'or');\n this.eFilterBody.appendChild(eJoinOperatorPanel);\n const index = this.eJoinOperatorPanels.length - 1;\n const uniqueGroupId = this.joinOperatorId++;\n this.resetJoinOperatorAnd(eJoinOperatorAnd, index, uniqueGroupId);\n this.resetJoinOperatorOr(eJoinOperatorOr, index, uniqueGroupId);\n if (!this.isReadOnly()) {\n eJoinOperatorAnd.onValueChange(this.listener);\n eJoinOperatorOr.onValueChange(this.listener);\n }\n }\n createJoinOperator(eJoinOperators, eJoinOperatorPanel, andOr) {\n const eJoinOperator = this.createManagedBean(new AgRadioButton());\n eJoinOperators.push(eJoinOperator);\n eJoinOperator.addCssClass('ag-filter-condition-operator');\n eJoinOperator.addCssClass(`ag-filter-condition-operator-${andOr}`);\n eJoinOperatorPanel.appendChild(eJoinOperator.getGui());\n return eJoinOperator;\n }\n getDefaultJoinOperator(defaultJoinOperator) {\n return defaultJoinOperator === 'AND' || defaultJoinOperator === 'OR' ? defaultJoinOperator : 'AND';\n }\n createFilterListOptions() {\n const filterOptions = this.optionsFactory.getFilterOptions();\n this.filterListOptions = filterOptions.map(option => typeof option === 'string' ?\n this.createBoilerplateListOption(option) :\n this.createCustomListOption(option));\n }\n putOptionsIntoDropdown(eType) {\n // Add specified options to condition drop-down.\n this.filterListOptions.forEach(listOption => {\n eType.addOption(listOption);\n });\n // Make drop-downs read-only if there is only one option.\n eType.setDisabled(this.filterListOptions.length <= 1);\n }\n createBoilerplateListOption(option) {\n return { value: option, text: this.translate(option) };\n }\n createCustomListOption(option) {\n const { displayKey } = option;\n const customOption = this.optionsFactory.getCustomOption(option.displayKey);\n return {\n value: displayKey,\n text: customOption ?\n this.localeService.getLocaleTextFunc()(customOption.displayKey, customOption.displayName) :\n this.translate(displayKey),\n };\n }\n /**\n * @deprecated As of v29.2 filters can have more than two conditions. Check `colDef.filterParams.maxNumConditions` instead.\n */\n isAllowTwoConditions() {\n return this.maxNumConditions >= 2;\n }\n createBodyTemplate() {\n // created dynamically\n return '';\n }\n getCssIdentifier() {\n return 'simple-filter';\n }\n updateUiVisibility() {\n const joinOperator = this.getJoinOperator();\n this.updateNumConditions();\n // from here, the number of elements in all the collections is correct, so can just update the values/statuses\n this.updateConditionStatusesAndValues(this.lastUiCompletePosition, joinOperator);\n }\n updateNumConditions() {\n var _a;\n // Collection sizes are already correct if updated via API, so only need to handle UI updates here\n let lastUiCompletePosition = -1;\n let areAllConditionsUiComplete = true;\n for (let position = 0; position < this.getNumConditions(); position++) {\n if (this.isConditionUiComplete(position)) {\n lastUiCompletePosition = position;\n }\n else {\n areAllConditionsUiComplete = false;\n }\n }\n if (this.shouldAddNewConditionAtEnd(areAllConditionsUiComplete)) {\n this.createJoinOperatorPanel();\n this.createOption();\n }\n else {\n const activePosition = (_a = this.lastUiCompletePosition) !== null && _a !== void 0 ? _a : this.getNumConditions() - 2;\n if (lastUiCompletePosition < activePosition) {\n // remove any incomplete conditions at the end, excluding the active position\n this.removeConditionsAndOperators(activePosition + 1);\n const removeStartPosition = lastUiCompletePosition + 1;\n const numConditionsToRemove = activePosition - removeStartPosition;\n if (numConditionsToRemove > 0) {\n this.removeConditionsAndOperators(removeStartPosition, numConditionsToRemove);\n }\n this.createMissingConditionsAndOperators();\n }\n }\n this.lastUiCompletePosition = lastUiCompletePosition;\n }\n updateConditionStatusesAndValues(lastUiCompletePosition, joinOperator) {\n this.eTypes.forEach((eType, position) => {\n const disabled = this.isConditionDisabled(position, lastUiCompletePosition);\n eType.setDisabled(disabled || this.filterListOptions.length <= 1);\n if (position === 1) {\n setDisabled(this.eJoinOperatorPanels[0], disabled);\n this.eJoinOperatorsAnd[0].setDisabled(disabled);\n this.eJoinOperatorsOr[0].setDisabled(disabled);\n }\n });\n this.eConditionBodies.forEach((element, index) => {\n setDisplayed(element, this.isConditionBodyVisible(index));\n });\n const orChecked = (joinOperator !== null && joinOperator !== void 0 ? joinOperator : this.getJoinOperator()) === 'OR';\n this.eJoinOperatorsAnd.forEach((eJoinOperatorAnd, index) => {\n eJoinOperatorAnd.setValue(!orChecked, true);\n });\n this.eJoinOperatorsOr.forEach((eJoinOperatorOr, index) => {\n eJoinOperatorOr.setValue(orChecked, true);\n });\n this.forEachInput((element, index, position, numberOfInputs) => {\n this.setElementDisplayed(element, index < numberOfInputs);\n this.setElementDisabled(element, this.isConditionDisabled(position, lastUiCompletePosition));\n });\n this.resetPlaceholder();\n }\n shouldAddNewConditionAtEnd(areAllConditionsUiComplete) {\n return areAllConditionsUiComplete && this.getNumConditions() < this.maxNumConditions && !this.isReadOnly();\n }\n removeConditionsAndOperators(startPosition, deleteCount) {\n if (startPosition >= this.getNumConditions()) {\n return;\n }\n this.removeComponents(this.eTypes, startPosition, deleteCount);\n this.removeElements(this.eConditionBodies, startPosition, deleteCount);\n this.removeValueElements(startPosition, deleteCount);\n const joinOperatorIndex = Math.max(startPosition - 1, 0);\n this.removeElements(this.eJoinOperatorPanels, joinOperatorIndex, deleteCount);\n this.removeComponents(this.eJoinOperatorsAnd, joinOperatorIndex, deleteCount);\n this.removeComponents(this.eJoinOperatorsOr, joinOperatorIndex, deleteCount);\n }\n removeElements(elements, startPosition, deleteCount) {\n const removedElements = this.removeItems(elements, startPosition, deleteCount);\n removedElements.forEach(element => removeFromParent(element));\n }\n removeComponents(components, startPosition, deleteCount) {\n const removedComponents = this.removeItems(components, startPosition, deleteCount);\n removedComponents.forEach(comp => {\n removeFromParent(comp.getGui());\n this.destroyBean(comp);\n });\n }\n removeItems(items, startPosition, deleteCount) {\n return deleteCount == null ? items.splice(startPosition) : items.splice(startPosition, deleteCount);\n }\n afterGuiAttached(params) {\n super.afterGuiAttached(params);\n this.resetPlaceholder();\n if (!(params === null || params === void 0 ? void 0 : params.suppressFocus)) {\n if (this.isReadOnly()) {\n // something needs focus otherwise keyboard navigation breaks, so focus the filter body\n this.eFilterBody.focus();\n }\n else {\n const firstInput = this.getInputs(0)[0];\n if (!firstInput) {\n return;\n }\n if (firstInput instanceof AgAbstractInputField) {\n firstInput.getInputElement().focus();\n }\n }\n }\n }\n afterGuiDetached() {\n super.afterGuiDetached();\n const appliedModel = this.getModel();\n if (!this.areModelsEqual(appliedModel, this.getModelFromUi()) || this.hasInvalidInputs()) {\n this.resetUiToActiveModel(appliedModel);\n }\n // remove incomplete positions\n let lastUiCompletePosition = -1;\n // as we remove incomplete positions, the last UI complete position will change\n let updatedLastUiCompletePosition = -1;\n let conditionsRemoved = false;\n const joinOperator = this.getJoinOperator();\n for (let position = this.getNumConditions() - 1; position >= 0; position--) {\n if (this.isConditionUiComplete(position)) {\n if (lastUiCompletePosition === -1) {\n lastUiCompletePosition = position;\n updatedLastUiCompletePosition = position;\n }\n }\n else {\n const shouldRemovePositionAtEnd = position >= this.numAlwaysVisibleConditions && !this.isConditionUiComplete(position - 1);\n const positionBeforeLastUiCompletePosition = position < lastUiCompletePosition;\n if (shouldRemovePositionAtEnd || positionBeforeLastUiCompletePosition) {\n this.removeConditionsAndOperators(position, 1);\n conditionsRemoved = true;\n if (positionBeforeLastUiCompletePosition) {\n updatedLastUiCompletePosition--;\n }\n }\n }\n }\n let shouldUpdateConditionStatusesAndValues = false;\n if (this.getNumConditions() < this.numAlwaysVisibleConditions) {\n // if conditions have been removed, need to recreate new ones at the end up to the number required\n this.createMissingConditionsAndOperators();\n shouldUpdateConditionStatusesAndValues = true;\n }\n if (this.shouldAddNewConditionAtEnd(updatedLastUiCompletePosition === this.getNumConditions() - 1)) {\n this.createJoinOperatorPanel();\n this.createOption();\n shouldUpdateConditionStatusesAndValues = true;\n }\n if (shouldUpdateConditionStatusesAndValues) {\n this.updateConditionStatusesAndValues(updatedLastUiCompletePosition, joinOperator);\n }\n if (conditionsRemoved) {\n this.updateJoinOperatorsDisabled();\n }\n this.lastUiCompletePosition = updatedLastUiCompletePosition;\n }\n getPlaceholderText(defaultPlaceholder, position) {\n let placeholder = this.translate(defaultPlaceholder);\n if (isFunction(this.filterPlaceholder)) {\n const filterPlaceholderFn = this.filterPlaceholder;\n const filterOptionKey = this.eTypes[position].getValue();\n const filterOption = this.translate(filterOptionKey);\n placeholder = filterPlaceholderFn({\n filterOptionKey,\n filterOption,\n placeholder\n });\n }\n else if (typeof this.filterPlaceholder === 'string') {\n placeholder = this.filterPlaceholder;\n }\n return placeholder;\n }\n // allow sub-classes to reset HTML placeholders after UI update.\n resetPlaceholder() {\n const globalTranslate = this.localeService.getLocaleTextFunc();\n this.forEachInput((element, index, position, numberOfInputs) => {\n if (!(element instanceof AgAbstractInputField)) {\n return;\n }\n const placeholder = index === 0 && numberOfInputs > 1 ? 'inRangeStart' :\n index === 0 ? 'filterOoo' :\n 'inRangeEnd';\n const ariaLabel = index === 0 && numberOfInputs > 1 ? globalTranslate('ariaFilterFromValue', 'Filter from value') :\n index === 0 ? globalTranslate('ariaFilterValue', 'Filter Value') :\n globalTranslate('ariaFilterToValue', 'Filter to Value');\n element.setInputPlaceholder(this.getPlaceholderText(placeholder, position));\n element.setInputAriaLabel(ariaLabel);\n });\n }\n setElementValue(element, value) {\n if (element instanceof AgAbstractInputField) {\n element.setValue(value != null ? String(value) : null, true);\n }\n }\n setElementDisplayed(element, displayed) {\n if (element instanceof Component) {\n setDisplayed(element.getGui(), displayed);\n }\n }\n setElementDisabled(element, disabled) {\n if (element instanceof Component) {\n setDisabled(element.getGui(), disabled);\n }\n }\n attachElementOnChange(element, listener) {\n if (element instanceof AgAbstractInputField) {\n element.onValueChange(listener);\n }\n }\n forEachInput(cb) {\n this.getConditionTypes().forEach((type, position) => {\n this.forEachPositionTypeInput(position, type, cb);\n });\n }\n forEachPositionInput(position, cb) {\n const type = this.getConditionType(position);\n this.forEachPositionTypeInput(position, type, cb);\n }\n forEachPositionTypeInput(position, type, cb) {\n const numberOfInputs = this.getNumberOfInputs(type);\n const inputs = this.getInputs(position);\n for (let index = 0; index < inputs.length; index++) {\n const input = inputs[index];\n if (input != null) {\n cb(input, index, position, numberOfInputs);\n }\n }\n }\n isConditionDisabled(position, lastUiCompletePosition) {\n if (this.isReadOnly()) {\n return true;\n } // Read-only mode trumps everything.\n if (position === 0) {\n return false;\n } // Position 0 should typically be editable.\n // Only allow editing of a 2nd or later condition if the previous condition is complete and no subsequent conditions are complete.\n return position > lastUiCompletePosition + 1;\n }\n isConditionBodyVisible(position) {\n // Check that the condition needs inputs.\n const type = this.getConditionType(position);\n const numberOfInputs = this.getNumberOfInputs(type);\n return numberOfInputs > 0;\n }\n // returns true if the UI represents a working filter, eg all parts are filled out.\n // eg if text filter and textfield blank then returns false.\n isConditionUiComplete(position) {\n if (position >= this.getNumConditions()) {\n return false;\n } // Condition doesn't exist.\n const type = this.getConditionType(position);\n if (type === SimpleFilter.EMPTY) {\n return false;\n }\n if (this.getValues(position).some(v => v == null)) {\n return false;\n }\n return true;\n }\n getNumConditions() {\n return this.eTypes.length;\n }\n getUiCompleteConditions() {\n const conditions = [];\n for (let position = 0; position < this.getNumConditions(); position++) {\n if (this.isConditionUiComplete(position)) {\n conditions.push(this.createCondition(position));\n }\n }\n return conditions;\n }\n createMissingConditionsAndOperators() {\n if (this.isReadOnly()) {\n return;\n } // don't show incomplete conditions when read only\n for (let i = this.getNumConditions(); i < this.numAlwaysVisibleConditions; i++) {\n this.createJoinOperatorPanel();\n this.createOption();\n }\n }\n resetUiToDefaults(silent) {\n this.removeConditionsAndOperators(this.isReadOnly() ? 1 : this.numAlwaysVisibleConditions);\n this.eTypes.forEach(eType => this.resetType(eType));\n this.eJoinOperatorsAnd.forEach((eJoinOperatorAnd, index) => this.resetJoinOperatorAnd(eJoinOperatorAnd, index, this.joinOperatorId + index));\n this.eJoinOperatorsOr.forEach((eJoinOperatorOr, index) => this.resetJoinOperatorOr(eJoinOperatorOr, index, this.joinOperatorId + index));\n this.joinOperatorId++;\n this.forEachInput((element) => this.resetInput(element));\n this.resetPlaceholder();\n this.createMissingConditionsAndOperators();\n this.lastUiCompletePosition = null;\n if (!silent) {\n this.onUiChanged();\n }\n return AgPromise.resolve();\n }\n resetType(eType) {\n const translate = this.localeService.getLocaleTextFunc();\n const filteringLabel = translate('ariaFilteringOperator', 'Filtering operator');\n eType\n .setValue(this.optionsFactory.getDefaultOption(), true)\n .setAriaLabel(filteringLabel)\n .setDisabled(this.isReadOnly() || this.filterListOptions.length <= 1);\n }\n resetJoinOperatorAnd(eJoinOperatorAnd, index, uniqueGroupId) {\n this.resetJoinOperator(eJoinOperatorAnd, index, this.isDefaultOperator('AND'), this.translate('andCondition'), uniqueGroupId);\n }\n resetJoinOperatorOr(eJoinOperatorOr, index, uniqueGroupId) {\n this.resetJoinOperator(eJoinOperatorOr, index, this.isDefaultOperator('OR'), this.translate('orCondition'), uniqueGroupId);\n }\n resetJoinOperator(eJoinOperator, index, value, label, uniqueGroupId) {\n this.updateJoinOperatorDisabled(eJoinOperator\n .setValue(value, true)\n .setName(`ag-simple-filter-and-or-${this.getCompId()}-${uniqueGroupId}`)\n .setLabel(label), index);\n }\n updateJoinOperatorsDisabled() {\n this.eJoinOperatorsAnd.forEach((eJoinOperator, index) => this.updateJoinOperatorDisabled(eJoinOperator, index));\n this.eJoinOperatorsOr.forEach((eJoinOperator, index) => this.updateJoinOperatorDisabled(eJoinOperator, index));\n }\n updateJoinOperatorDisabled(eJoinOperator, index) {\n eJoinOperator.setDisabled(this.isReadOnly() || index > 0);\n }\n resetInput(element) {\n this.setElementValue(element, null);\n this.setElementDisabled(element, this.isReadOnly());\n }\n // puts model values into the UI\n setConditionIntoUi(model, position) {\n const values = this.mapValuesFromModel(model);\n this.forEachInput((element, index, elPosition, _) => {\n if (elPosition !== position) {\n return;\n }\n this.setElementValue(element, values[index] != null ? values[index] : null);\n });\n }\n // after floating filter changes, this sets the 'value' section. this is implemented by the base class\n // (as that's where value is controlled), the 'type' part from the floating filter is dealt with in this class.\n setValueFromFloatingFilter(value) {\n this.forEachInput((element, index, position, _) => {\n this.setElementValue(element, index === 0 && position === 0 ? value : null);\n });\n }\n isDefaultOperator(operator) {\n return operator === this.defaultJoinOperator;\n }\n addChangedListeners(eType, position) {\n if (this.isReadOnly()) {\n return;\n }\n eType.onValueChange(this.listener);\n this.forEachPositionInput(position, (element) => {\n this.attachElementOnChange(element, this.listener);\n });\n }\n /** returns true if the row passes the said condition */\n individualConditionPasses(params, filterModel) {\n const cellValue = this.getCellValue(params.node);\n const values = this.mapValuesFromModel(filterModel);\n const customFilterOption = this.optionsFactory.getCustomOption(filterModel.type);\n const customFilterResult = this.evaluateCustomFilter(customFilterOption, values, cellValue);\n if (customFilterResult != null) {\n return customFilterResult;\n }\n if (cellValue == null) {\n return this.evaluateNullValue(filterModel.type);\n }\n return this.evaluateNonNullValue(values, cellValue, filterModel, params);\n }\n evaluateCustomFilter(customFilterOption, values, cellValue) {\n if (customFilterOption == null) {\n return;\n }\n const { predicate } = customFilterOption;\n // only execute the custom filter if a value exists or a value isn't required, i.e. input is hidden\n if (predicate != null && !values.some(v => v == null)) {\n return predicate(values, cellValue);\n }\n // No custom filter invocation, indicate that to the caller.\n return;\n }\n isBlank(cellValue) {\n return cellValue == null ||\n (typeof cellValue === 'string' && cellValue.trim().length === 0);\n }\n hasInvalidInputs() {\n return false;\n }\n}\nSimpleFilter.EMPTY = 'empty';\nSimpleFilter.BLANK = 'blank';\nSimpleFilter.NOT_BLANK = 'notBlank';\nSimpleFilter.EQUALS = 'equals';\nSimpleFilter.NOT_EQUAL = 'notEqual';\nSimpleFilter.LESS_THAN = 'lessThan';\nSimpleFilter.LESS_THAN_OR_EQUAL = 'lessThanOrEqual';\nSimpleFilter.GREATER_THAN = 'greaterThan';\nSimpleFilter.GREATER_THAN_OR_EQUAL = 'greaterThanOrEqual';\nSimpleFilter.IN_RANGE = 'inRange';\nSimpleFilter.CONTAINS = 'contains';\nSimpleFilter.NOT_CONTAINS = 'notContains';\nSimpleFilter.STARTS_WITH = 'startsWith';\nSimpleFilter.ENDS_WITH = 'endsWith';\n","import { SimpleFilter } from \"./simpleFilter.mjs\";\nexport class ScalarFilter extends SimpleFilter {\n setParams(params) {\n super.setParams(params);\n this.scalarFilterParams = params;\n }\n evaluateNullValue(filterType) {\n switch (filterType) {\n case ScalarFilter.EQUALS:\n case ScalarFilter.NOT_EQUAL:\n if (this.scalarFilterParams.includeBlanksInEquals) {\n return true;\n }\n break;\n case ScalarFilter.GREATER_THAN:\n case ScalarFilter.GREATER_THAN_OR_EQUAL:\n if (this.scalarFilterParams.includeBlanksInGreaterThan) {\n return true;\n }\n break;\n case ScalarFilter.LESS_THAN:\n case ScalarFilter.LESS_THAN_OR_EQUAL:\n if (this.scalarFilterParams.includeBlanksInLessThan) {\n return true;\n }\n break;\n case ScalarFilter.IN_RANGE:\n if (this.scalarFilterParams.includeBlanksInRange) {\n return true;\n }\n break;\n case ScalarFilter.BLANK:\n return true;\n case ScalarFilter.NOT_BLANK:\n return false;\n }\n return false;\n }\n evaluateNonNullValue(values, cellValue, filterModel) {\n const comparator = this.comparator();\n const compareResult = values[0] != null ? comparator(values[0], cellValue) : 0;\n switch (filterModel.type) {\n case ScalarFilter.EQUALS:\n return compareResult === 0;\n case ScalarFilter.NOT_EQUAL:\n return compareResult !== 0;\n case ScalarFilter.GREATER_THAN:\n return compareResult > 0;\n case ScalarFilter.GREATER_THAN_OR_EQUAL:\n return compareResult >= 0;\n case ScalarFilter.LESS_THAN:\n return compareResult < 0;\n case ScalarFilter.LESS_THAN_OR_EQUAL:\n return compareResult <= 0;\n case ScalarFilter.IN_RANGE: {\n const compareToResult = comparator(values[1], cellValue);\n return this.scalarFilterParams.inRangeInclusive ?\n compareResult >= 0 && compareToResult <= 0 :\n compareResult > 0 && compareToResult < 0;\n }\n case ScalarFilter.BLANK:\n return this.isBlank(cellValue);\n case ScalarFilter.NOT_BLANK:\n return !this.isBlank(cellValue);\n default:\n console.warn('AG Grid: Unexpected type of filter \"' + filterModel.type + '\", it looks like the filter was configured with incorrect Filter Options');\n return true;\n }\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired } from '../../../context/context.mjs';\nimport { DateCompWrapper } from './dateCompWrapper.mjs';\nimport { SimpleFilter, SimpleFilterModelFormatter } from '../simpleFilter.mjs';\nimport { ScalarFilter } from '../scalarFilter.mjs';\nimport { serialiseDate, parseDateTimeFromString, dateToFormattedString } from '../../../utils/date.mjs';\nconst DEFAULT_MIN_YEAR = 1000;\nconst DEFAULT_MAX_YEAR = Infinity;\nexport class DateFilterModelFormatter extends SimpleFilterModelFormatter {\n constructor(dateFilterParams, localeService, optionsFactory) {\n super(localeService, optionsFactory);\n this.dateFilterParams = dateFilterParams;\n }\n conditionToString(condition, options) {\n const { type } = condition;\n const { numberOfInputs } = options || {};\n const isRange = type == SimpleFilter.IN_RANGE || numberOfInputs === 2;\n const dateFrom = parseDateTimeFromString(condition.dateFrom);\n const dateTo = parseDateTimeFromString(condition.dateTo);\n const format = this.dateFilterParams.inRangeFloatingFilterDateFormat;\n if (isRange) {\n const formattedFrom = dateFrom !== null ? dateToFormattedString(dateFrom, format) : 'null';\n const formattedTo = dateTo !== null ? dateToFormattedString(dateTo, format) : 'null';\n return `${formattedFrom}-${formattedTo}`;\n }\n if (dateFrom != null) {\n return dateToFormattedString(dateFrom, format);\n }\n // cater for when the type doesn't need a value\n return `${type}`;\n }\n updateParams(params) {\n super.updateParams(params);\n this.dateFilterParams = params.dateFilterParams;\n }\n}\nexport class DateFilter extends ScalarFilter {\n constructor() {\n super('dateFilter');\n this.eConditionPanelsFrom = [];\n this.eConditionPanelsTo = [];\n this.dateConditionFromComps = [];\n this.dateConditionToComps = [];\n this.minValidYear = DEFAULT_MIN_YEAR;\n this.maxValidYear = DEFAULT_MAX_YEAR;\n }\n afterGuiAttached(params) {\n super.afterGuiAttached(params);\n this.dateConditionFromComps[0].afterGuiAttached(params);\n }\n mapValuesFromModel(filterModel) {\n // unlike the other filters, we do two things here:\n // 1) allow for different attribute names (same as done for other filters) (eg the 'from' and 'to'\n // are in different locations in Date and Number filter models)\n // 2) convert the type (because Date filter uses Dates, however model is 'string')\n //\n // NOTE: The conversion of string to date also removes the timezone - i.e. when user picks\n // a date from the UI, it will have timezone info in it. This is lost when creating\n // the model. When we recreate the date again here, it's without a timezone.\n const { dateFrom, dateTo, type } = filterModel || {};\n return [\n dateFrom && parseDateTimeFromString(dateFrom) || null,\n dateTo && parseDateTimeFromString(dateTo) || null,\n ].slice(0, this.getNumberOfInputs(type));\n }\n comparator() {\n return this.dateFilterParams.comparator ? this.dateFilterParams.comparator : this.defaultComparator.bind(this);\n }\n defaultComparator(filterDate, cellValue) {\n // The default comparator assumes that the cellValue is a date\n const cellAsDate = cellValue;\n if (cellValue == null || cellAsDate < filterDate) {\n return -1;\n }\n if (cellAsDate > filterDate) {\n return 1;\n }\n return 0;\n }\n setParams(params) {\n this.dateFilterParams = params;\n super.setParams(params);\n const yearParser = (param, fallback) => {\n if (params[param] != null) {\n if (!isNaN(params[param])) {\n return params[param] == null ? fallback : Number(params[param]);\n }\n else {\n console.warn(`AG Grid: DateFilter ${param} is not a number`);\n }\n }\n return fallback;\n };\n this.minValidYear = yearParser('minValidYear', DEFAULT_MIN_YEAR);\n this.maxValidYear = yearParser('maxValidYear', DEFAULT_MAX_YEAR);\n if (this.minValidYear > this.maxValidYear) {\n console.warn(`AG Grid: DateFilter minValidYear should be <= maxValidYear`);\n }\n this.filterModelFormatter = new DateFilterModelFormatter(this.dateFilterParams, this.localeService, this.optionsFactory);\n }\n createDateCompWrapper(element) {\n const dateCompWrapper = new DateCompWrapper(this.getContext(), this.userComponentFactory, {\n onDateChanged: () => this.onUiChanged(),\n filterParams: this.dateFilterParams\n }, element);\n this.addDestroyFunc(() => dateCompWrapper.destroy());\n return dateCompWrapper;\n }\n setElementValue(element, value) {\n element.setDate(value);\n }\n setElementDisplayed(element, displayed) {\n element.setDisplayed(displayed);\n }\n setElementDisabled(element, disabled) {\n element.setDisabled(disabled);\n }\n getDefaultFilterOptions() {\n return DateFilter.DEFAULT_FILTER_OPTIONS;\n }\n createValueElement() {\n const eCondition = document.createElement('div');\n eCondition.classList.add('ag-filter-body');\n this.createFromToElement(eCondition, this.eConditionPanelsFrom, this.dateConditionFromComps, 'from');\n this.createFromToElement(eCondition, this.eConditionPanelsTo, this.dateConditionToComps, 'to');\n return eCondition;\n }\n createFromToElement(eCondition, eConditionPanels, dateConditionComps, fromTo) {\n const eConditionPanel = document.createElement('div');\n eConditionPanel.classList.add(`ag-filter-${fromTo}`);\n eConditionPanel.classList.add(`ag-filter-date-${fromTo}`);\n eConditionPanels.push(eConditionPanel);\n eCondition.appendChild(eConditionPanel);\n dateConditionComps.push(this.createDateCompWrapper(eConditionPanel));\n }\n removeValueElements(startPosition, deleteCount) {\n this.removeDateComps(this.dateConditionFromComps, startPosition, deleteCount);\n this.removeDateComps(this.dateConditionToComps, startPosition, deleteCount);\n this.removeItems(this.eConditionPanelsFrom, startPosition, deleteCount);\n this.removeItems(this.eConditionPanelsTo, startPosition, deleteCount);\n }\n removeDateComps(components, startPosition, deleteCount) {\n const removedComponents = this.removeItems(components, startPosition, deleteCount);\n removedComponents.forEach(comp => comp.destroy());\n }\n isConditionUiComplete(position) {\n if (!super.isConditionUiComplete(position)) {\n return false;\n }\n const isValidDate = (value) => value != null\n && value.getUTCFullYear() >= this.minValidYear\n && value.getUTCFullYear() <= this.maxValidYear;\n let valid = true;\n this.forEachInput((element, index, elPosition, numberOfInputs) => {\n if (elPosition !== position || !valid || index >= numberOfInputs) {\n return;\n }\n valid = valid && isValidDate(element.getDate());\n });\n return valid;\n }\n areSimpleModelsEqual(aSimple, bSimple) {\n return aSimple.dateFrom === bSimple.dateFrom\n && aSimple.dateTo === bSimple.dateTo\n && aSimple.type === bSimple.type;\n }\n getFilterType() {\n return 'date';\n }\n createCondition(position) {\n const type = this.getConditionType(position);\n const model = {};\n const values = this.getValues(position);\n if (values.length > 0) {\n model.dateFrom = serialiseDate(values[0]);\n }\n if (values.length > 1) {\n model.dateTo = serialiseDate(values[1]);\n }\n return Object.assign({ dateFrom: null, dateTo: null, filterType: this.getFilterType(), type }, model);\n }\n resetPlaceholder() {\n const globalTranslate = this.localeService.getLocaleTextFunc();\n const placeholder = this.translate('dateFormatOoo');\n const ariaLabel = globalTranslate('ariaFilterValue', 'Filter Value');\n this.forEachInput((element) => {\n element.setInputPlaceholder(placeholder);\n element.setInputAriaLabel(ariaLabel);\n });\n }\n getInputs(position) {\n if (position >= this.dateConditionFromComps.length) {\n return [null, null];\n }\n return [this.dateConditionFromComps[position], this.dateConditionToComps[position]];\n }\n getValues(position) {\n const result = [];\n this.forEachPositionInput(position, (element, index, _elPosition, numberOfInputs) => {\n if (index < numberOfInputs) {\n result.push(element.getDate());\n }\n });\n return result;\n }\n getModelAsString(model) {\n var _a;\n return (_a = this.filterModelFormatter.getModelAsString(model)) !== null && _a !== void 0 ? _a : '';\n }\n}\nDateFilter.DEFAULT_FILTER_OPTIONS = [\n ScalarFilter.EQUALS,\n ScalarFilter.GREATER_THAN,\n ScalarFilter.LESS_THAN,\n ScalarFilter.NOT_EQUAL,\n ScalarFilter.IN_RANGE,\n ScalarFilter.BLANK,\n ScalarFilter.NOT_BLANK,\n];\n__decorate([\n Autowired('userComponentFactory')\n], DateFilter.prototype, \"userComponentFactory\", void 0);\n","import { Component } from '../../../widgets/component.mjs';\nimport { SimpleFilter } from '../../provided/simpleFilter.mjs';\nimport { OptionsFactory } from '../../provided/optionsFactory.mjs';\nexport class SimpleFloatingFilter extends Component {\n getDefaultDebounceMs() {\n return 0;\n }\n // this is a user component, and IComponent has \"public destroy()\" as part of the interface.\n // so we need to override destroy() just to make the method public.\n destroy() {\n super.destroy();\n }\n isEventFromFloatingFilter(event) {\n return event && event.afterFloatingFilter;\n }\n isEventFromDataChange(event) {\n return event === null || event === void 0 ? void 0 : event.afterDataChange;\n }\n getLastType() {\n return this.lastType;\n }\n isReadOnly() {\n return this.readOnly;\n }\n setLastTypeFromModel(model) {\n // if no model provided by the parent filter use default\n if (!model) {\n this.lastType = this.optionsFactory.getDefaultOption();\n return;\n }\n const isCombined = model.operator;\n let condition;\n if (isCombined) {\n const combinedModel = model;\n condition = combinedModel.conditions[0];\n }\n else {\n condition = model;\n }\n this.lastType = condition.type;\n }\n canWeEditAfterModelFromParentFilter(model) {\n if (!model) {\n // if no model, then we can edit as long as the lastType is something we can edit, as this\n // is the type we will provide to the parent filter if the user decides to use the floating filter.\n return this.isTypeEditable(this.lastType);\n }\n // never allow editing if the filter is combined (ie has two parts)\n const isCombined = model.operator;\n if (isCombined) {\n return false;\n }\n const simpleModel = model;\n return this.isTypeEditable(simpleModel.type);\n }\n init(params) {\n this.setSimpleParams(params);\n }\n setSimpleParams(params) {\n this.optionsFactory = new OptionsFactory();\n this.optionsFactory.init(params.filterParams, this.getDefaultFilterOptions());\n this.lastType = this.optionsFactory.getDefaultOption();\n // readOnly is a property of ProvidedFilterParams - we need to find a better (type-safe)\n // way to support reading this in the future.\n this.readOnly = !!params.filterParams.readOnly;\n // we are editable if:\n // 1) there is a type (user has configured filter wrong if not type)\n // AND\n // 2) the default type is not 'in range'\n const editable = this.isTypeEditable(this.lastType);\n this.setEditable(editable);\n }\n onParamsUpdated(params) {\n this.setSimpleParams(params);\n }\n doesFilterHaveSingleInput(filterType) {\n const customFilterOption = this.optionsFactory.getCustomOption(filterType);\n const { numberOfInputs } = customFilterOption || {};\n return numberOfInputs == null || numberOfInputs == 1;\n }\n isTypeEditable(type) {\n const uneditableTypes = [\n SimpleFilter.IN_RANGE, SimpleFilter.EMPTY, SimpleFilter.BLANK, SimpleFilter.NOT_BLANK,\n ];\n return !!type &&\n !this.isReadOnly() &&\n this.doesFilterHaveSingleInput(type) &&\n uneditableTypes.indexOf(type) < 0;\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { DateFilter, DateFilterModelFormatter } from './dateFilter.mjs';\nimport { Autowired } from '../../../context/context.mjs';\nimport { DateCompWrapper } from './dateCompWrapper.mjs';\nimport { RefSelector } from '../../../widgets/componentAnnotations.mjs';\nimport { SimpleFloatingFilter } from '../../floating/provided/simpleFloatingFilter.mjs';\nimport { ProvidedFilter } from '../providedFilter.mjs';\nimport { setDisplayed } from '../../../utils/dom.mjs';\nimport { parseDateTimeFromString, serialiseDate } from '../../../utils/date.mjs';\nimport { debounce } from '../../../utils/function.mjs';\nexport class DateFloatingFilter extends SimpleFloatingFilter {\n constructor() {\n super(/* html */ `\n
\n \n
\n
`);\n }\n getDefaultFilterOptions() {\n return DateFilter.DEFAULT_FILTER_OPTIONS;\n }\n init(params) {\n super.init(params);\n this.params = params;\n this.filterParams = params.filterParams;\n this.createDateComponent();\n this.filterModelFormatter = new DateFilterModelFormatter(this.filterParams, this.localeService, this.optionsFactory);\n const translate = this.localeService.getLocaleTextFunc();\n this.eReadOnlyText\n .setDisabled(true)\n .setInputAriaLabel(translate('ariaDateFilterInput', 'Date Filter Input'));\n }\n onParamsUpdated(params) {\n super.onParamsUpdated(params);\n this.params = params;\n this.filterParams = params.filterParams;\n this.updateDateComponent();\n this.filterModelFormatter.updateParams({ optionsFactory: this.optionsFactory, dateFilterParams: this.filterParams });\n }\n setEditable(editable) {\n setDisplayed(this.eDateWrapper, editable);\n setDisplayed(this.eReadOnlyText.getGui(), !editable);\n }\n onParentModelChanged(model, event) {\n // We don't want to update the floating filter if the floating filter caused the change,\n // because the UI is already in sync. if we didn't do this, the UI would behave strangely\n // as it would be updating as the user is typing.\n // This is similar for data changes, which don't affect provided date floating filters\n if (this.isEventFromFloatingFilter(event) || this.isEventFromDataChange(event)) {\n return;\n }\n super.setLastTypeFromModel(model);\n const allowEditing = !this.isReadOnly() &&\n this.canWeEditAfterModelFromParentFilter(model);\n this.setEditable(allowEditing);\n if (allowEditing) {\n if (model) {\n const dateModel = model;\n this.dateComp.setDate(parseDateTimeFromString(dateModel.dateFrom));\n }\n else {\n this.dateComp.setDate(null);\n }\n this.eReadOnlyText.setValue('');\n }\n else {\n this.eReadOnlyText.setValue(this.filterModelFormatter.getModelAsString(model));\n this.dateComp.setDate(null);\n }\n }\n onDateChanged() {\n const filterValueDate = this.dateComp.getDate();\n const filterValueText = serialiseDate(filterValueDate);\n this.params.parentFilterInstance(filterInstance => {\n if (filterInstance) {\n const date = parseDateTimeFromString(filterValueText);\n filterInstance.onFloatingFilterChanged(this.getLastType() || null, date);\n }\n });\n }\n getDateComponentParams() {\n const debounceMs = ProvidedFilter.getDebounceMs(this.params.filterParams, this.getDefaultDebounceMs());\n return {\n onDateChanged: debounce(this.onDateChanged.bind(this), debounceMs),\n filterParams: this.params.column.getColDef().filterParams\n };\n }\n createDateComponent() {\n this.dateComp = new DateCompWrapper(this.getContext(), this.userComponentFactory, this.getDateComponentParams(), this.eDateWrapper);\n this.addDestroyFunc(() => this.dateComp.destroy());\n }\n updateDateComponent() {\n const params = this.getDateComponentParams();\n const { api, columnApi, context } = this.gridOptionsService;\n params.api = api;\n params.columnApi = columnApi;\n params.context = context;\n this.dateComp.updateParams(params);\n }\n getFilterModelFormatter() {\n return this.filterModelFormatter;\n }\n}\n__decorate([\n Autowired('userComponentFactory')\n], DateFloatingFilter.prototype, \"userComponentFactory\", void 0);\n__decorate([\n RefSelector('eReadOnlyText')\n], DateFloatingFilter.prototype, \"eReadOnlyText\", void 0);\n__decorate([\n RefSelector('eDateWrapper')\n], DateFloatingFilter.prototype, \"eDateWrapper\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from '../../../widgets/component.mjs';\nimport { RefSelector } from '../../../widgets/componentAnnotations.mjs';\nimport { serialiseDate, parseDateTimeFromString } from '../../../utils/date.mjs';\nimport { getSafariVersion, isBrowserChrome, isBrowserFirefox, isBrowserSafari } from '../../../utils/browser.mjs';\nexport class DefaultDateComponent extends Component {\n constructor() {\n super(/* html */ `\n
\n \n
`);\n }\n // this is a user component, and IComponent has \"public destroy()\" as part of the interface.\n // so we need to override destroy() just to make the method public.\n destroy() {\n super.destroy();\n }\n init(params) {\n this.params = params;\n this.setParams(params);\n const eDocument = this.gridOptionsService.getDocument();\n const inputElement = this.eDateInput.getInputElement();\n // ensures that the input element is focussed when a clear button is clicked,\n // unless using safari as there is no clear button and focus does not work properly\n this.addManagedListener(inputElement, 'mousedown', () => {\n if (this.eDateInput.isDisabled() || this.usingSafariDatePicker) {\n return;\n }\n inputElement.focus();\n });\n this.addManagedListener(inputElement, 'input', e => {\n if (e.target !== eDocument.activeElement) {\n return;\n }\n if (this.eDateInput.isDisabled()) {\n return;\n }\n this.params.onDateChanged();\n });\n }\n setParams(params) {\n const inputElement = this.eDateInput.getInputElement();\n const shouldUseBrowserDatePicker = this.shouldUseBrowserDatePicker(params);\n this.usingSafariDatePicker = shouldUseBrowserDatePicker && isBrowserSafari();\n inputElement.type = shouldUseBrowserDatePicker ? 'date' : 'text';\n const { minValidYear, maxValidYear } = params.filterParams || {};\n if (minValidYear) {\n inputElement.min = `${minValidYear}-01-01`;\n }\n if (maxValidYear) {\n inputElement.max = `${maxValidYear}-12-31`;\n }\n }\n onParamsUpdated(params) {\n this.params = params;\n this.setParams(params);\n }\n getDate() {\n return parseDateTimeFromString(this.eDateInput.getValue());\n }\n setDate(date) {\n this.eDateInput.setValue(serialiseDate(date, false));\n }\n setInputPlaceholder(placeholder) {\n this.eDateInput.setInputPlaceholder(placeholder);\n }\n setDisabled(disabled) {\n this.eDateInput.setDisabled(disabled);\n }\n afterGuiAttached(params) {\n if (!params || !params.suppressFocus) {\n this.eDateInput.getInputElement().focus();\n }\n }\n shouldUseBrowserDatePicker(params) {\n if (params.filterParams && params.filterParams.browserDatePicker != null) {\n return params.filterParams.browserDatePicker;\n }\n return isBrowserChrome() || isBrowserFirefox() || (isBrowserSafari() && getSafariVersion() >= 14.1);\n }\n}\n__decorate([\n RefSelector('eDateInput')\n], DefaultDateComponent.prototype, \"eDateInput\", void 0);\n","import { AgAbstractInputField } from './agAbstractInputField.mjs';\nimport { exists } from '../utils/generic.mjs';\nimport { isEventFromPrintableCharacter } from '../utils/keyboard.mjs';\nexport class AgInputTextField extends AgAbstractInputField {\n constructor(config, className = 'ag-text-field', inputType = 'text') {\n super(config, className, inputType);\n }\n postConstruct() {\n super.postConstruct();\n if (this.config.allowedCharPattern) {\n this.preventDisallowedCharacters();\n }\n }\n setValue(value, silent) {\n // update the input before we call super.setValue, so it's updated before the value changed event is fired\n if (this.eInput.value !== value) {\n this.eInput.value = exists(value) ? value : '';\n }\n return super.setValue(value, silent);\n }\n /** Used to set an initial value into the input without necessarily setting `this.value` or triggering events (e.g. to set an invalid value) */\n setStartValue(value) {\n this.setValue(value, true);\n }\n preventDisallowedCharacters() {\n const pattern = new RegExp(`[${this.config.allowedCharPattern}]`);\n const preventCharacters = (event) => {\n if (!isEventFromPrintableCharacter(event)) {\n return;\n }\n if (event.key && !pattern.test(event.key)) {\n event.preventDefault();\n }\n };\n this.addManagedListener(this.eInput, 'keydown', preventCharacters);\n this.addManagedListener(this.eInput, 'paste', (e) => {\n var _a;\n const text = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text');\n if (text && text.split('').some((c) => !pattern.test(c))) {\n e.preventDefault();\n }\n });\n }\n}\n","import { AgInputTextField } from \"./agInputTextField.mjs\";\nimport { addOrRemoveAttribute } from '../utils/dom.mjs';\nimport { exists } from \"../utils/generic.mjs\";\nexport class AgInputNumberField extends AgInputTextField {\n constructor(config) {\n super(config, 'ag-number-field', 'number');\n }\n postConstruct() {\n super.postConstruct();\n this.addManagedListener(this.eInput, 'blur', () => {\n const floatedValue = parseFloat(this.eInput.value);\n const value = isNaN(floatedValue) ? '' : this.normalizeValue(floatedValue.toString());\n if (this.value !== value) {\n this.setValue(value);\n }\n });\n this.addManagedListener(this.eInput, 'wheel', this.onWheel.bind(this));\n this.eInput.step = 'any';\n }\n onWheel(e) {\n // Prevent default scroll events from incrementing / decrementing the input, since its inconsistent between browsers\n if (document.activeElement === this.eInput) {\n e.preventDefault();\n }\n }\n normalizeValue(value) {\n if (value === '') {\n return '';\n }\n if (this.precision != null) {\n value = this.adjustPrecision(value);\n }\n const val = parseFloat(value);\n if (this.min != null && val < this.min) {\n value = this.min.toString();\n }\n else if (this.max != null && val > this.max) {\n value = this.max.toString();\n }\n return value;\n }\n adjustPrecision(value, isScientificNotation) {\n if (this.precision == null) {\n return value;\n }\n if (isScientificNotation) {\n const floatString = parseFloat(value).toFixed(this.precision);\n return parseFloat(floatString).toString();\n }\n // can't use toFixed here because we don't want to round up\n const parts = String(value).split('.');\n if (parts.length > 1) {\n if (parts[1].length <= this.precision) {\n return value;\n }\n else if (this.precision > 0) {\n return `${parts[0]}.${parts[1].slice(0, this.precision)}`;\n }\n }\n return parts[0];\n }\n setMin(min) {\n if (this.min === min) {\n return this;\n }\n this.min = min;\n addOrRemoveAttribute(this.eInput, 'min', min);\n return this;\n }\n setMax(max) {\n if (this.max === max) {\n return this;\n }\n this.max = max;\n addOrRemoveAttribute(this.eInput, 'max', max);\n return this;\n }\n setPrecision(precision) {\n this.precision = precision;\n return this;\n }\n setStep(step) {\n if (this.step === step) {\n return this;\n }\n this.step = step;\n addOrRemoveAttribute(this.eInput, 'step', step);\n return this;\n }\n setValue(value, silent) {\n return this.setValueOrInputValue(v => super.setValue(v, silent), () => this, value);\n }\n setStartValue(value) {\n return this.setValueOrInputValue(v => super.setValue(v, true), v => { this.eInput.value = v; }, value);\n }\n setValueOrInputValue(setValueFunc, setInputValueOnlyFunc, value) {\n if (exists(value)) {\n // need to maintain the scientific notation format whilst typing (e.g. 1e10)\n let setInputValueOnly = this.isScientificNotation(value);\n if (setInputValueOnly && this.eInput.validity.valid) {\n return setValueFunc(value);\n }\n if (!setInputValueOnly) {\n value = this.adjustPrecision(value);\n const normalizedValue = this.normalizeValue(value);\n // outside of valid range\n setInputValueOnly = value != normalizedValue;\n }\n if (setInputValueOnly) {\n return setInputValueOnlyFunc(value);\n }\n }\n return setValueFunc(value);\n }\n getValue() {\n if (!this.eInput.validity.valid) {\n return undefined;\n }\n const inputValue = this.eInput.value;\n if (this.isScientificNotation(inputValue)) {\n return this.adjustPrecision(inputValue, true);\n }\n return super.getValue();\n }\n isScientificNotation(value) {\n return typeof value === 'string' && value.includes('e');\n }\n}\n","import { SimpleFilter, SimpleFilterModelFormatter } from '../simpleFilter.mjs';\nimport { ScalarFilter } from '../scalarFilter.mjs';\nimport { makeNull } from '../../../utils/generic.mjs';\nimport { AgInputTextField } from '../../../widgets/agInputTextField.mjs';\nimport { setAriaRole } from '../../../utils/aria.mjs';\nimport { AgInputNumberField } from '../../../widgets/agInputNumberField.mjs';\nexport class NumberFilterModelFormatter extends SimpleFilterModelFormatter {\n conditionToString(condition, options) {\n const { numberOfInputs } = options || {};\n const isRange = condition.type == SimpleFilter.IN_RANGE || numberOfInputs === 2;\n if (isRange) {\n return `${this.formatValue(condition.filter)}-${this.formatValue(condition.filterTo)}`;\n }\n // cater for when the type doesn't need a value\n if (condition.filter != null) {\n return this.formatValue(condition.filter);\n }\n return `${condition.type}`;\n }\n}\nexport function getAllowedCharPattern(filterParams) {\n const { allowedCharPattern } = filterParams !== null && filterParams !== void 0 ? filterParams : {};\n return allowedCharPattern !== null && allowedCharPattern !== void 0 ? allowedCharPattern : null;\n}\nexport class NumberFilter extends ScalarFilter {\n constructor() {\n super('numberFilter');\n this.eValuesFrom = [];\n this.eValuesTo = [];\n }\n mapValuesFromModel(filterModel) {\n const { filter, filterTo, type } = filterModel || {};\n return [\n this.processValue(filter),\n this.processValue(filterTo),\n ].slice(0, this.getNumberOfInputs(type));\n }\n getDefaultDebounceMs() {\n return 500;\n }\n comparator() {\n return (left, right) => {\n if (left === right) {\n return 0;\n }\n return left < right ? 1 : -1;\n };\n }\n setParams(params) {\n this.numberFilterParams = params;\n super.setParams(params);\n this.filterModelFormatter = new NumberFilterModelFormatter(this.localeService, this.optionsFactory, this.numberFilterParams.numberFormatter);\n }\n getDefaultFilterOptions() {\n return NumberFilter.DEFAULT_FILTER_OPTIONS;\n }\n setElementValue(element, value) {\n const valueToSet = this.numberFilterParams.numberFormatter\n ? this.numberFilterParams.numberFormatter(value !== null && value !== void 0 ? value : null)\n : value;\n super.setElementValue(element, valueToSet);\n }\n createValueElement() {\n const allowedCharPattern = getAllowedCharPattern(this.numberFilterParams);\n const eCondition = document.createElement('div');\n eCondition.classList.add('ag-filter-body');\n setAriaRole(eCondition, 'presentation');\n this.createFromToElement(eCondition, this.eValuesFrom, 'from', allowedCharPattern);\n this.createFromToElement(eCondition, this.eValuesTo, 'to', allowedCharPattern);\n return eCondition;\n }\n createFromToElement(eCondition, eValues, fromTo, allowedCharPattern) {\n const eValue = this.createManagedBean(allowedCharPattern ? new AgInputTextField({ allowedCharPattern }) : new AgInputNumberField());\n eValue.addCssClass(`ag-filter-${fromTo}`);\n eValue.addCssClass('ag-filter-filter');\n eValues.push(eValue);\n eCondition.appendChild(eValue.getGui());\n }\n removeValueElements(startPosition, deleteCount) {\n this.removeComponents(this.eValuesFrom, startPosition, deleteCount);\n this.removeComponents(this.eValuesTo, startPosition, deleteCount);\n }\n getValues(position) {\n const result = [];\n this.forEachPositionInput(position, (element, index, _elPosition, numberOfInputs) => {\n if (index < numberOfInputs) {\n result.push(this.processValue(this.stringToFloat(element.getValue())));\n }\n });\n return result;\n }\n areSimpleModelsEqual(aSimple, bSimple) {\n return aSimple.filter === bSimple.filter\n && aSimple.filterTo === bSimple.filterTo\n && aSimple.type === bSimple.type;\n }\n getFilterType() {\n return 'number';\n }\n processValue(value) {\n if (value == null) {\n return null;\n }\n return isNaN(value) ? null : value;\n }\n stringToFloat(value) {\n if (typeof value === 'number') {\n return value;\n }\n let filterText = makeNull(value);\n if (filterText != null && filterText.trim() === '') {\n filterText = null;\n }\n if (this.numberFilterParams.numberParser) {\n return this.numberFilterParams.numberParser(filterText);\n }\n return filterText == null || filterText.trim() === '-' ? null : parseFloat(filterText);\n }\n createCondition(position) {\n const type = this.getConditionType(position);\n const model = {\n filterType: this.getFilterType(),\n type\n };\n const values = this.getValues(position);\n if (values.length > 0) {\n model.filter = values[0];\n }\n if (values.length > 1) {\n model.filterTo = values[1];\n }\n return model;\n }\n getInputs(position) {\n if (position >= this.eValuesFrom.length) {\n return [null, null];\n }\n return [this.eValuesFrom[position], this.eValuesTo[position]];\n }\n getModelAsString(model) {\n var _a;\n return (_a = this.filterModelFormatter.getModelAsString(model)) !== null && _a !== void 0 ? _a : '';\n }\n hasInvalidInputs() {\n let invalidInputs = false;\n this.forEachInput(element => {\n if (!element.getInputElement().validity.valid) {\n invalidInputs = true;\n return;\n }\n });\n return invalidInputs;\n }\n}\nNumberFilter.DEFAULT_FILTER_OPTIONS = [\n ScalarFilter.EQUALS,\n ScalarFilter.NOT_EQUAL,\n ScalarFilter.LESS_THAN,\n ScalarFilter.LESS_THAN_OR_EQUAL,\n ScalarFilter.GREATER_THAN,\n ScalarFilter.GREATER_THAN_OR_EQUAL,\n ScalarFilter.IN_RANGE,\n ScalarFilter.BLANK,\n ScalarFilter.NOT_BLANK,\n];\n","import { SimpleFilter, SimpleFilterModelFormatter } from '../simpleFilter.mjs';\nimport { AgInputTextField } from '../../../widgets/agInputTextField.mjs';\nimport { makeNull } from '../../../utils/generic.mjs';\nimport { _ } from '../../../utils/index.mjs';\nimport { setAriaRole } from '../../../utils/aria.mjs';\nexport class TextFilterModelFormatter extends SimpleFilterModelFormatter {\n conditionToString(condition, options) {\n const { numberOfInputs } = options || {};\n const isRange = condition.type == SimpleFilter.IN_RANGE || numberOfInputs === 2;\n if (isRange) {\n return `${condition.filter}-${condition.filterTo}`;\n }\n // cater for when the type doesn't need a value\n if (condition.filter != null) {\n return `${condition.filter}`;\n }\n return `${condition.type}`;\n }\n}\nexport class TextFilter extends SimpleFilter {\n constructor() {\n super('textFilter');\n this.eValuesFrom = [];\n this.eValuesTo = [];\n }\n static trimInput(value) {\n const trimmedInput = value && value.trim();\n // trim the input, unless it is all whitespace (this is consistent with Excel behaviour)\n return trimmedInput === '' ? value : trimmedInput;\n }\n getDefaultDebounceMs() {\n return 500;\n }\n setParams(params) {\n this.textFilterParams = params;\n super.setParams(params);\n this.matcher = this.getTextMatcher();\n this.formatter = this.textFilterParams.textFormatter ||\n (this.textFilterParams.caseSensitive ? TextFilter.DEFAULT_FORMATTER : TextFilter.DEFAULT_LOWERCASE_FORMATTER);\n this.filterModelFormatter = new TextFilterModelFormatter(this.localeService, this.optionsFactory);\n }\n getTextMatcher() {\n const legacyComparator = this.textFilterParams.textCustomComparator;\n if (legacyComparator) {\n _.doOnce(() => console.warn('AG Grid - textCustomComparator is deprecated, use textMatcher instead.'), 'textCustomComparator.deprecated');\n return ({ filterOption, value, filterText }) => legacyComparator(filterOption, value, filterText);\n }\n return this.textFilterParams.textMatcher || TextFilter.DEFAULT_MATCHER;\n }\n createCondition(position) {\n const type = this.getConditionType(position);\n const model = {\n filterType: this.getFilterType(),\n type,\n };\n const values = this.getValuesWithSideEffects(position, true);\n if (values.length > 0) {\n model.filter = values[0];\n }\n if (values.length > 1) {\n model.filterTo = values[1];\n }\n return model;\n }\n getFilterType() {\n return 'text';\n }\n areSimpleModelsEqual(aSimple, bSimple) {\n return aSimple.filter === bSimple.filter &&\n aSimple.filterTo === bSimple.filterTo &&\n aSimple.type === bSimple.type;\n }\n getInputs(position) {\n if (position >= this.eValuesFrom.length) {\n return [null, null];\n }\n return [this.eValuesFrom[position], this.eValuesTo[position]];\n }\n getValues(position) {\n return this.getValuesWithSideEffects(position, false);\n }\n getValuesWithSideEffects(position, applySideEffects) {\n const result = [];\n this.forEachPositionInput(position, (element, index, _elPosition, numberOfInputs) => {\n var _a;\n if (index < numberOfInputs) {\n let value = makeNull(element.getValue());\n if (applySideEffects && this.textFilterParams.trimInput) {\n value = (_a = TextFilter.trimInput(value)) !== null && _a !== void 0 ? _a : null;\n element.setValue(value, true); // ensure clean value is visible\n }\n result.push(value);\n }\n });\n return result;\n }\n getDefaultFilterOptions() {\n return TextFilter.DEFAULT_FILTER_OPTIONS;\n }\n createValueElement() {\n const eCondition = document.createElement('div');\n eCondition.classList.add('ag-filter-body');\n setAriaRole(eCondition, 'presentation');\n this.createFromToElement(eCondition, this.eValuesFrom, 'from');\n this.createFromToElement(eCondition, this.eValuesTo, 'to');\n return eCondition;\n }\n createFromToElement(eCondition, eValues, fromTo) {\n const eValue = this.createManagedBean(new AgInputTextField());\n eValue.addCssClass(`ag-filter-${fromTo}`);\n eValue.addCssClass('ag-filter-filter');\n eValues.push(eValue);\n eCondition.appendChild(eValue.getGui());\n }\n removeValueElements(startPosition, deleteCount) {\n this.removeComponents(this.eValuesFrom, startPosition, deleteCount);\n this.removeComponents(this.eValuesTo, startPosition, deleteCount);\n }\n mapValuesFromModel(filterModel) {\n const { filter, filterTo, type } = filterModel || {};\n return [\n filter || null,\n filterTo || null,\n ].slice(0, this.getNumberOfInputs(type));\n }\n evaluateNullValue(filterType) {\n const filterTypesAllowNulls = [\n SimpleFilter.NOT_EQUAL, SimpleFilter.NOT_CONTAINS, SimpleFilter.BLANK,\n ];\n return filterType ? filterTypesAllowNulls.indexOf(filterType) >= 0 : false;\n }\n evaluateNonNullValue(values, cellValue, filterModel, params) {\n const formattedValues = values.map(v => this.formatter(v)) || [];\n const cellValueFormatted = this.formatter(cellValue);\n const { api, colDef, column, columnApi, context, textFormatter } = this.textFilterParams;\n if (filterModel.type === SimpleFilter.BLANK) {\n return this.isBlank(cellValue);\n }\n else if (filterModel.type === SimpleFilter.NOT_BLANK) {\n return !this.isBlank(cellValue);\n }\n const matcherParams = {\n api,\n colDef,\n column,\n columnApi,\n context,\n node: params.node,\n data: params.data,\n filterOption: filterModel.type,\n value: cellValueFormatted,\n textFormatter,\n };\n return formattedValues.some(v => this.matcher(Object.assign(Object.assign({}, matcherParams), { filterText: v })));\n }\n getModelAsString(model) {\n var _a;\n return (_a = this.filterModelFormatter.getModelAsString(model)) !== null && _a !== void 0 ? _a : '';\n }\n}\nTextFilter.DEFAULT_FILTER_OPTIONS = [\n SimpleFilter.CONTAINS,\n SimpleFilter.NOT_CONTAINS,\n SimpleFilter.EQUALS,\n SimpleFilter.NOT_EQUAL,\n SimpleFilter.STARTS_WITH,\n SimpleFilter.ENDS_WITH,\n SimpleFilter.BLANK,\n SimpleFilter.NOT_BLANK,\n];\nTextFilter.DEFAULT_FORMATTER = (from) => from;\nTextFilter.DEFAULT_LOWERCASE_FORMATTER = (from) => from == null ? null : from.toString().toLowerCase();\nTextFilter.DEFAULT_MATCHER = ({ filterOption, value, filterText }) => {\n if (filterText == null) {\n return false;\n }\n switch (filterOption) {\n case TextFilter.CONTAINS:\n return value.indexOf(filterText) >= 0;\n case TextFilter.NOT_CONTAINS:\n return value.indexOf(filterText) < 0;\n case TextFilter.EQUALS:\n return value === filterText;\n case TextFilter.NOT_EQUAL:\n return value != filterText;\n case TextFilter.STARTS_WITH:\n return value.indexOf(filterText) === 0;\n case TextFilter.ENDS_WITH:\n const index = value.lastIndexOf(filterText);\n return index >= 0 && index === (value.length - filterText.length);\n default:\n return false;\n }\n};\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { RefSelector } from '../../../widgets/componentAnnotations.mjs';\nimport { debounce } from '../../../utils/function.mjs';\nimport { ProvidedFilter } from '../../provided/providedFilter.mjs';\nimport { PostConstruct, Autowired } from '../../../context/context.mjs';\nimport { SimpleFloatingFilter } from './simpleFloatingFilter.mjs';\nimport { AgInputTextField } from '../../../widgets/agInputTextField.mjs';\nimport { KeyCode } from '../../../constants/keyCode.mjs';\nimport { TextFilter } from '../../provided/text/textFilter.mjs';\nimport { BeanStub } from '../../../context/beanStub.mjs';\nimport { clearElement } from '../../../utils/dom.mjs';\nexport class FloatingFilterTextInputService extends BeanStub {\n constructor(params) {\n super();\n this.params = params;\n this.valueChangedListener = () => { };\n }\n setupGui(parentElement) {\n var _a;\n this.eFloatingFilterTextInput = this.createManagedBean(new AgInputTextField((_a = this.params) === null || _a === void 0 ? void 0 : _a.config));\n const eInput = this.eFloatingFilterTextInput.getGui();\n parentElement.appendChild(eInput);\n this.addManagedListener(eInput, 'input', (e) => this.valueChangedListener(e));\n this.addManagedListener(eInput, 'keydown', (e) => this.valueChangedListener(e));\n }\n setEditable(editable) {\n this.eFloatingFilterTextInput.setDisabled(!editable);\n }\n setAutoComplete(autoComplete) {\n this.eFloatingFilterTextInput.setAutoComplete(autoComplete);\n }\n getValue() {\n return this.eFloatingFilterTextInput.getValue();\n }\n setValue(value, silent) {\n this.eFloatingFilterTextInput.setValue(value, silent);\n }\n setValueChangedListener(listener) {\n this.valueChangedListener = listener;\n }\n setParams(params) {\n this.setAriaLabel(params.ariaLabel);\n if (params.autoComplete !== undefined) {\n this.setAutoComplete(params.autoComplete);\n }\n }\n setAriaLabel(ariaLabel) {\n this.eFloatingFilterTextInput.setInputAriaLabel(ariaLabel);\n }\n}\n;\nexport class TextInputFloatingFilter extends SimpleFloatingFilter {\n postConstruct() {\n this.setTemplate(/* html */ `\n
\n `);\n }\n getDefaultDebounceMs() {\n return 500;\n }\n onParentModelChanged(model, event) {\n if (this.isEventFromFloatingFilter(event) || this.isEventFromDataChange(event)) {\n // if the floating filter triggered the change, it is already in sync.\n // Data changes also do not affect provided text floating filters\n return;\n }\n this.setLastTypeFromModel(model);\n this.setEditable(this.canWeEditAfterModelFromParentFilter(model));\n this.floatingFilterInputService.setValue(this.getFilterModelFormatter().getModelAsString(model));\n }\n init(params) {\n this.setupFloatingFilterInputService(params);\n super.init(params);\n this.setTextInputParams(params);\n }\n setupFloatingFilterInputService(params) {\n this.floatingFilterInputService = this.createFloatingFilterInputService(params);\n this.floatingFilterInputService.setupGui(this.eFloatingFilterInputContainer);\n }\n setTextInputParams(params) {\n var _a;\n this.params = params;\n const autoComplete = (_a = params.browserAutoComplete) !== null && _a !== void 0 ? _a : false;\n this.floatingFilterInputService.setParams({\n ariaLabel: this.getAriaLabel(params),\n autoComplete,\n });\n this.applyActive = ProvidedFilter.isUseApplyButton(this.params.filterParams);\n if (!this.isReadOnly()) {\n const debounceMs = ProvidedFilter.getDebounceMs(this.params.filterParams, this.getDefaultDebounceMs());\n const toDebounce = debounce(this.syncUpWithParentFilter.bind(this), debounceMs);\n this.floatingFilterInputService.setValueChangedListener(toDebounce);\n }\n }\n onParamsUpdated(params) {\n super.onParamsUpdated(params);\n this.setTextInputParams(params);\n }\n recreateFloatingFilterInputService(params) {\n const value = this.floatingFilterInputService.getValue();\n clearElement(this.eFloatingFilterInputContainer);\n this.destroyBean(this.floatingFilterInputService);\n this.setupFloatingFilterInputService(params);\n this.floatingFilterInputService.setValue(value, true);\n }\n getAriaLabel(params) {\n const displayName = this.columnModel.getDisplayNameForColumn(params.column, 'header', true);\n const translate = this.localeService.getLocaleTextFunc();\n return `${displayName} ${translate('ariaFilterInput', 'Filter Input')}`;\n }\n syncUpWithParentFilter(e) {\n const isEnterKey = e.key === KeyCode.ENTER;\n if (this.applyActive && !isEnterKey) {\n return;\n }\n let value = this.floatingFilterInputService.getValue();\n if (this.params.filterParams.trimInput) {\n value = TextFilter.trimInput(value);\n this.floatingFilterInputService.setValue(value, true); // ensure visible value is trimmed\n }\n this.params.parentFilterInstance(filterInstance => {\n if (filterInstance) {\n // NumberFilter is typed as number, but actually receives string values\n filterInstance.onFloatingFilterChanged(this.getLastType() || null, value || null);\n }\n });\n }\n setEditable(editable) {\n this.floatingFilterInputService.setEditable(editable);\n }\n}\n__decorate([\n Autowired('columnModel')\n], TextInputFloatingFilter.prototype, \"columnModel\", void 0);\n__decorate([\n RefSelector('eFloatingFilterInputContainer')\n], TextInputFloatingFilter.prototype, \"eFloatingFilterInputContainer\", void 0);\n__decorate([\n PostConstruct\n], TextInputFloatingFilter.prototype, \"postConstruct\", null);\n","import { getAllowedCharPattern, NumberFilter, NumberFilterModelFormatter } from './numberFilter.mjs';\nimport { FloatingFilterTextInputService, TextInputFloatingFilter } from '../../floating/provided/textInputFloatingFilter.mjs';\nimport { AgInputNumberField } from '../../../widgets/agInputNumberField.mjs';\nimport { AgInputTextField } from '../../../widgets/agInputTextField.mjs';\nimport { BeanStub } from '../../../context/beanStub.mjs';\nclass FloatingFilterNumberInputService extends BeanStub {\n constructor() {\n super(...arguments);\n this.valueChangedListener = () => { };\n this.numberInputActive = true;\n }\n setupGui(parentElement) {\n this.eFloatingFilterNumberInput = this.createManagedBean(new AgInputNumberField());\n this.eFloatingFilterTextInput = this.createManagedBean(new AgInputTextField());\n this.eFloatingFilterTextInput.setDisabled(true);\n const eNumberInput = this.eFloatingFilterNumberInput.getGui();\n const eTextInput = this.eFloatingFilterTextInput.getGui();\n parentElement.appendChild(eNumberInput);\n parentElement.appendChild(eTextInput);\n this.setupListeners(eNumberInput, (e) => this.valueChangedListener(e));\n this.setupListeners(eTextInput, (e) => this.valueChangedListener(e));\n }\n setEditable(editable) {\n this.numberInputActive = editable;\n this.eFloatingFilterNumberInput.setDisplayed(this.numberInputActive);\n this.eFloatingFilterTextInput.setDisplayed(!this.numberInputActive);\n }\n setAutoComplete(autoComplete) {\n this.eFloatingFilterNumberInput.setAutoComplete(autoComplete);\n this.eFloatingFilterTextInput.setAutoComplete(autoComplete);\n }\n getValue() {\n return this.getActiveInputElement().getValue();\n }\n setValue(value, silent) {\n this.getActiveInputElement().setValue(value, silent);\n }\n getActiveInputElement() {\n return this.numberInputActive ? this.eFloatingFilterNumberInput : this.eFloatingFilterTextInput;\n }\n setValueChangedListener(listener) {\n this.valueChangedListener = listener;\n }\n setupListeners(element, listener) {\n this.addManagedListener(element, 'input', listener);\n this.addManagedListener(element, 'keydown', listener);\n }\n setParams(params) {\n this.setAriaLabel(params.ariaLabel);\n if (params.autoComplete !== undefined) {\n this.setAutoComplete(params.autoComplete);\n }\n }\n setAriaLabel(ariaLabel) {\n this.eFloatingFilterNumberInput.setInputAriaLabel(ariaLabel);\n this.eFloatingFilterTextInput.setInputAriaLabel(ariaLabel);\n }\n}\nexport class NumberFloatingFilter extends TextInputFloatingFilter {\n init(params) {\n var _a;\n super.init(params);\n this.filterModelFormatter = new NumberFilterModelFormatter(this.localeService, this.optionsFactory, (_a = params.filterParams) === null || _a === void 0 ? void 0 : _a.numberFormatter);\n }\n onParamsUpdated(params) {\n const allowedCharPattern = getAllowedCharPattern(params.filterParams);\n if (allowedCharPattern !== this.allowedCharPattern) {\n this.recreateFloatingFilterInputService(params);\n }\n super.onParamsUpdated(params);\n this.filterModelFormatter.updateParams({ optionsFactory: this.optionsFactory });\n }\n getDefaultFilterOptions() {\n return NumberFilter.DEFAULT_FILTER_OPTIONS;\n }\n getFilterModelFormatter() {\n return this.filterModelFormatter;\n }\n createFloatingFilterInputService(params) {\n this.allowedCharPattern = getAllowedCharPattern(params.filterParams);\n if (this.allowedCharPattern) {\n // need to use text input\n return this.createManagedBean(new FloatingFilterTextInputService({\n config: { allowedCharPattern: this.allowedCharPattern },\n }));\n }\n return this.createManagedBean(new FloatingFilterNumberInputService());\n }\n}\n","import { TextFilter, TextFilterModelFormatter } from './textFilter.mjs';\nimport { FloatingFilterTextInputService, TextInputFloatingFilter } from '../../floating/provided/textInputFloatingFilter.mjs';\nexport class TextFloatingFilter extends TextInputFloatingFilter {\n init(params) {\n super.init(params);\n this.filterModelFormatter = new TextFilterModelFormatter(this.localeService, this.optionsFactory);\n }\n onParamsUpdated(params) {\n super.onParamsUpdated(params);\n this.filterModelFormatter.updateParams({ optionsFactory: this.optionsFactory });\n }\n getDefaultFilterOptions() {\n return TextFilter.DEFAULT_FILTER_OPTIONS;\n }\n getFilterModelFormatter() {\n return this.filterModelFormatter;\n }\n createFloatingFilterInputService() {\n return this.createManagedBean(new FloatingFilterTextInputService());\n }\n}\n","import { EventService } from \"../eventService.mjs\";\nimport { areEventsNear } from \"../utils/mouse.mjs\";\nexport class TouchListener {\n constructor(eElement, preventMouseClick = false) {\n this.destroyFuncs = [];\n this.touching = false;\n this.eventService = new EventService();\n this.eElement = eElement;\n this.preventMouseClick = preventMouseClick;\n const startListener = this.onTouchStart.bind(this);\n const moveListener = this.onTouchMove.bind(this);\n const endListener = this.onTouchEnd.bind(this);\n this.eElement.addEventListener(\"touchstart\", startListener, { passive: true });\n this.eElement.addEventListener(\"touchmove\", moveListener, { passive: true });\n // we set passive=false, as we want to prevent default on this event\n this.eElement.addEventListener(\"touchend\", endListener, { passive: false });\n this.destroyFuncs.push(() => {\n this.eElement.removeEventListener(\"touchstart\", startListener, { passive: true });\n this.eElement.removeEventListener(\"touchmove\", moveListener, { passive: true });\n this.eElement.removeEventListener(\"touchend\", endListener, { passive: false });\n });\n }\n getActiveTouch(touchList) {\n for (let i = 0; i < touchList.length; i++) {\n const matches = touchList[i].identifier === this.touchStart.identifier;\n if (matches) {\n return touchList[i];\n }\n }\n return null;\n }\n addEventListener(eventType, listener) {\n this.eventService.addEventListener(eventType, listener);\n }\n removeEventListener(eventType, listener) {\n this.eventService.removeEventListener(eventType, listener);\n }\n onTouchStart(touchEvent) {\n // only looking at one touch point at any time\n if (this.touching) {\n return;\n }\n this.touchStart = touchEvent.touches[0];\n this.touching = true;\n this.moved = false;\n const touchStartCopy = this.touchStart;\n window.setTimeout(() => {\n const touchesMatch = this.touchStart === touchStartCopy;\n if (this.touching && touchesMatch && !this.moved) {\n this.moved = true;\n const event = {\n type: TouchListener.EVENT_LONG_TAP,\n touchStart: this.touchStart,\n touchEvent: touchEvent\n };\n this.eventService.dispatchEvent(event);\n }\n }, 500);\n }\n onTouchMove(touchEvent) {\n if (!this.touching) {\n return;\n }\n const touch = this.getActiveTouch(touchEvent.touches);\n if (!touch) {\n return;\n }\n const eventIsFarAway = !areEventsNear(touch, this.touchStart, 4);\n if (eventIsFarAway) {\n this.moved = true;\n }\n }\n onTouchEnd(touchEvent) {\n if (!this.touching) {\n return;\n }\n if (!this.moved) {\n const event = {\n type: TouchListener.EVENT_TAP,\n touchStart: this.touchStart\n };\n this.eventService.dispatchEvent(event);\n this.checkForDoubleTap();\n }\n // stops the tap from also been processed as a mouse click\n if (this.preventMouseClick && touchEvent.cancelable) {\n touchEvent.preventDefault();\n }\n this.touching = false;\n }\n checkForDoubleTap() {\n const now = new Date().getTime();\n if (this.lastTapTime && this.lastTapTime > 0) {\n // if previous tap, see if duration is short enough to be considered double tap\n const interval = now - this.lastTapTime;\n if (interval > TouchListener.DOUBLE_TAP_MILLIS) {\n // dispatch double tap event\n const event = {\n type: TouchListener.EVENT_DOUBLE_TAP,\n touchStart: this.touchStart\n };\n this.eventService.dispatchEvent(event);\n // this stops a tripple tap ending up as two double taps\n this.lastTapTime = null;\n }\n else {\n this.lastTapTime = now;\n }\n }\n else {\n this.lastTapTime = now;\n }\n }\n destroy() {\n this.destroyFuncs.forEach(func => func());\n }\n}\nTouchListener.EVENT_TAP = \"tap\";\nTouchListener.EVENT_DOUBLE_TAP = \"doubleTap\";\nTouchListener.EVENT_LONG_TAP = \"longTap\";\nTouchListener.DOUBLE_TAP_MILLIS = 500;\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Events } from \"../../../eventKeys.mjs\";\nimport { setDisplayed, clearElement } from \"../../../utils/dom.mjs\";\nimport { Autowired } from \"../../../context/context.mjs\";\nimport { RefSelector } from \"../../../widgets/componentAnnotations.mjs\";\nimport { Component } from \"../../../widgets/component.mjs\";\nimport { createIconNoSpan } from \"../../../utils/icon.mjs\";\nexport class SortIndicatorComp extends Component {\n constructor(skipTemplate) {\n super();\n if (!skipTemplate) {\n this.setTemplate(SortIndicatorComp.TEMPLATE);\n }\n }\n attachCustomElements(eSortOrder, eSortAsc, eSortDesc, eSortMixed, eSortNone) {\n this.eSortOrder = eSortOrder;\n this.eSortAsc = eSortAsc;\n this.eSortDesc = eSortDesc;\n this.eSortMixed = eSortMixed;\n this.eSortNone = eSortNone;\n }\n setupSort(column, suppressOrder = false) {\n this.column = column;\n this.suppressOrder = suppressOrder;\n this.setupMultiSortIndicator();\n const canSort = !!this.column.getColDef().sortable;\n if (!canSort) {\n return;\n }\n this.addInIcon('sortAscending', this.eSortAsc, column);\n this.addInIcon('sortDescending', this.eSortDesc, column);\n this.addInIcon('sortUnSort', this.eSortNone, column);\n // Watch global events, as row group columns can effect their display column.\n this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, () => this.onSortChanged());\n // when grouping changes so can sort indexes and icons\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, () => this.onSortChanged());\n this.onSortChanged();\n }\n addInIcon(iconName, eParent, column) {\n if (eParent == null) {\n return;\n }\n const eIcon = createIconNoSpan(iconName, this.gridOptionsService, column);\n if (eIcon) {\n eParent.appendChild(eIcon);\n }\n }\n onSortChanged() {\n this.updateIcons();\n if (!this.suppressOrder) {\n this.updateSortOrder();\n }\n }\n updateIcons() {\n const sortDirection = this.sortController.getDisplaySortForColumn(this.column);\n if (this.eSortAsc) {\n const isAscending = sortDirection === 'asc';\n setDisplayed(this.eSortAsc, isAscending, { skipAriaHidden: true });\n }\n if (this.eSortDesc) {\n const isDescending = sortDirection === 'desc';\n setDisplayed(this.eSortDesc, isDescending, { skipAriaHidden: true });\n }\n if (this.eSortNone) {\n const alwaysHideNoSort = !this.column.getColDef().unSortIcon && !this.gridOptionsService.is('unSortIcon');\n const isNone = sortDirection === null || sortDirection === undefined;\n setDisplayed(this.eSortNone, !alwaysHideNoSort && isNone, { skipAriaHidden: true });\n }\n }\n setupMultiSortIndicator() {\n this.addInIcon('sortUnSort', this.eSortMixed, this.column);\n const isColumnShowingRowGroup = this.column.getColDef().showRowGroup;\n const areGroupsCoupled = this.gridOptionsService.isColumnsSortingCoupledToGroup();\n if (areGroupsCoupled && isColumnShowingRowGroup) {\n // Watch global events, as row group columns can effect their display column.\n this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, () => this.updateMultiSortIndicator());\n // when grouping changes so can sort indexes and icons\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, () => this.updateMultiSortIndicator());\n this.updateMultiSortIndicator();\n }\n }\n updateMultiSortIndicator() {\n if (this.eSortMixed) {\n const isMixedSort = this.sortController.getDisplaySortForColumn(this.column) === 'mixed';\n setDisplayed(this.eSortMixed, isMixedSort, { skipAriaHidden: true });\n }\n }\n // we listen here for global sort events, NOT column sort events, as we want to do this\n // when sorting has been set on all column (if we listened just for our col (where we\n // set the asc / desc icons) then it's possible other cols are yet to get their sorting state.\n updateSortOrder() {\n var _a;\n if (!this.eSortOrder) {\n return;\n }\n const allColumnsWithSorting = this.sortController.getColumnsWithSortingOrdered();\n const indexThisCol = (_a = this.sortController.getDisplaySortIndexForColumn(this.column)) !== null && _a !== void 0 ? _a : -1;\n const moreThanOneColSorting = allColumnsWithSorting.some(col => { var _a; return (_a = this.sortController.getDisplaySortIndexForColumn(col)) !== null && _a !== void 0 ? _a : -1 >= 1; });\n const showIndex = indexThisCol >= 0 && moreThanOneColSorting;\n setDisplayed(this.eSortOrder, showIndex, { skipAriaHidden: true });\n if (indexThisCol >= 0) {\n this.eSortOrder.innerHTML = (indexThisCol + 1).toString();\n }\n else {\n clearElement(this.eSortOrder);\n }\n }\n}\nSortIndicatorComp.TEMPLATE = `\n \n \n \n \n \n `;\n__decorate([\n RefSelector('eSortOrder')\n], SortIndicatorComp.prototype, \"eSortOrder\", void 0);\n__decorate([\n RefSelector('eSortAsc')\n], SortIndicatorComp.prototype, \"eSortAsc\", void 0);\n__decorate([\n RefSelector('eSortDesc')\n], SortIndicatorComp.prototype, \"eSortDesc\", void 0);\n__decorate([\n RefSelector('eSortMixed')\n], SortIndicatorComp.prototype, \"eSortMixed\", void 0);\n__decorate([\n RefSelector('eSortNone')\n], SortIndicatorComp.prototype, \"eSortNone\", void 0);\n__decorate([\n Autowired('columnModel')\n], SortIndicatorComp.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('sortController')\n], SortIndicatorComp.prototype, \"sortController\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired } from \"../../../context/context.mjs\";\nimport { Column } from \"../../../entities/column.mjs\";\nimport { firstExistingValue } from \"../../../utils/array.mjs\";\nimport { isIOSUserAgent } from \"../../../utils/browser.mjs\";\nimport { removeFromParent, setDisplayed } from \"../../../utils/dom.mjs\";\nimport { exists } from \"../../../utils/generic.mjs\";\nimport { createIconNoSpan } from \"../../../utils/icon.mjs\";\nimport { escapeString } from \"../../../utils/string.mjs\";\nimport { Component } from \"../../../widgets/component.mjs\";\nimport { RefSelector } from \"../../../widgets/componentAnnotations.mjs\";\nimport { TouchListener } from \"../../../widgets/touchListener.mjs\";\nimport { SortIndicatorComp } from \"./sortIndicatorComp.mjs\";\nimport { Events } from \"../../../eventKeys.mjs\";\nexport class HeaderComp extends Component {\n constructor() {\n super(...arguments);\n this.lastMovingChanged = 0;\n }\n // this is a user component, and IComponent has \"public destroy()\" as part of the interface.\n // so we need to override destroy() just to make the method public.\n destroy() {\n super.destroy();\n }\n refresh(params) {\n this.params = params;\n // if template changed, then recreate the whole comp, the code required to manage\n // a changing template is to difficult for what it's worth.\n if (this.workOutTemplate() != this.currentTemplate) {\n return false;\n }\n if (this.workOutShowMenu() != this.currentShowMenu) {\n return false;\n }\n if (this.workOutSort() != this.currentSort) {\n return false;\n }\n this.setDisplayName(params);\n return true;\n }\n workOutTemplate() {\n let template = firstExistingValue(this.params.template, HeaderComp.TEMPLATE);\n // take account of any newlines & whitespace before/after the actual template\n template = template && template.trim ? template.trim() : template;\n return template;\n }\n init(params) {\n this.params = params;\n this.currentTemplate = this.workOutTemplate();\n this.setTemplate(this.currentTemplate);\n this.setupTap();\n this.setupIcons(params.column);\n this.setMenu();\n this.setupSort();\n this.setupFilterIcon();\n this.setDisplayName(params);\n }\n setDisplayName(params) {\n if (this.currentDisplayName != params.displayName) {\n this.currentDisplayName = params.displayName;\n const displayNameSanitised = escapeString(this.currentDisplayName);\n if (this.eText) {\n this.eText.innerHTML = displayNameSanitised;\n }\n }\n }\n setupIcons(column) {\n this.addInIcon('menu', this.eMenu, column);\n this.addInIcon('filter', this.eFilter, column);\n }\n addInIcon(iconName, eParent, column) {\n if (eParent == null) {\n return;\n }\n const eIcon = createIconNoSpan(iconName, this.gridOptionsService, column);\n if (eIcon) {\n eParent.appendChild(eIcon);\n }\n }\n setupTap() {\n const { gridOptionsService } = this;\n if (gridOptionsService.is('suppressTouch')) {\n return;\n }\n const touchListener = new TouchListener(this.getGui(), true);\n const suppressMenuHide = gridOptionsService.is('suppressMenuHide');\n const tapMenuButton = suppressMenuHide && exists(this.eMenu);\n const menuTouchListener = tapMenuButton ? new TouchListener(this.eMenu, true) : touchListener;\n if (this.params.enableMenu) {\n const eventType = tapMenuButton ? 'EVENT_TAP' : 'EVENT_LONG_TAP';\n const showMenuFn = (event) => {\n gridOptionsService.api.showColumnMenuAfterMouseClick(this.params.column, event.touchStart);\n };\n this.addManagedListener(menuTouchListener, TouchListener[eventType], showMenuFn);\n }\n if (this.params.enableSorting) {\n const tapListener = (event) => {\n const target = event.touchStart.target;\n // When suppressMenuHide is true, a tap on the menu icon will bubble up\n // to the header container, in that case we should not sort\n if (suppressMenuHide && this.eMenu.contains(target)) {\n return;\n }\n this.sortController.progressSort(this.params.column, false, \"uiColumnSorted\");\n };\n this.addManagedListener(touchListener, TouchListener.EVENT_TAP, tapListener);\n }\n // if tapMenuButton is true `touchListener` and `menuTouchListener` are different\n // so we need to make sure to destroy both listeners here\n this.addDestroyFunc(() => touchListener.destroy());\n if (tapMenuButton) {\n this.addDestroyFunc(() => menuTouchListener.destroy());\n }\n }\n workOutShowMenu() {\n // we don't show the menu if on an iPad/iPhone, as the user cannot have a pointer device/\n // However if suppressMenuHide is set to true the menu will be displayed alwasys, so it's ok\n // to show it on iPad in this case (as hover isn't needed). If suppressMenuHide\n // is false (default) user will need to use longpress to display the menu.\n const menuHides = !this.gridOptionsService.is('suppressMenuHide');\n const onIpadAndMenuHides = isIOSUserAgent() && menuHides;\n const showMenu = this.params.enableMenu && !onIpadAndMenuHides;\n return showMenu;\n }\n setMenu() {\n // if no menu provided in template, do nothing\n if (!this.eMenu) {\n return;\n }\n this.currentShowMenu = this.workOutShowMenu();\n if (!this.currentShowMenu) {\n removeFromParent(this.eMenu);\n return;\n }\n const suppressMenuHide = this.gridOptionsService.is('suppressMenuHide');\n this.addManagedListener(this.eMenu, 'click', () => this.showMenu(this.eMenu));\n this.eMenu.classList.toggle('ag-header-menu-always-show', suppressMenuHide);\n }\n showMenu(eventSource) {\n if (!eventSource) {\n eventSource = this.eMenu;\n }\n this.menuFactory.showMenuAfterButtonClick(this.params.column, eventSource, 'columnMenu');\n }\n workOutSort() {\n return this.params.enableSorting;\n }\n setupSort() {\n this.currentSort = this.params.enableSorting;\n // eSortIndicator will not be present when customers provided custom header\n // templates, in that case, we need to look for provided sort elements and\n // manually create eSortIndicator.\n if (!this.eSortIndicator) {\n this.eSortIndicator = this.context.createBean(new SortIndicatorComp(true));\n this.eSortIndicator.attachCustomElements(this.eSortOrder, this.eSortAsc, this.eSortDesc, this.eSortMixed, this.eSortNone);\n }\n this.eSortIndicator.setupSort(this.params.column);\n // we set up the indicator prior to the check for whether this column is sortable, as it allows the indicator to\n // set up the multi sort indicator which can appear irrelevant of whether this column can itself be sorted.\n // this can occur in the case of a non-sortable group display column.\n if (!this.currentSort) {\n return;\n }\n const sortUsingCtrl = this.gridOptionsService.get('multiSortKey') === 'ctrl';\n // keep track of last time the moving changed flag was set\n this.addManagedListener(this.params.column, Column.EVENT_MOVING_CHANGED, () => {\n this.lastMovingChanged = new Date().getTime();\n });\n // add the event on the header, so when clicked, we do sorting\n if (this.eLabel) {\n this.addManagedListener(this.eLabel, 'click', (event) => {\n // sometimes when moving a column via dragging, this was also firing a clicked event.\n // here is issue raised by user: https://ag-grid.zendesk.com/agent/tickets/1076\n // this check stops sort if a) column is moving or b) column moved less than 200ms ago (so caters for race condition)\n const moving = this.params.column.isMoving();\n const nowTime = new Date().getTime();\n // typically there is <2ms if moving flag was set recently, as it would be done in same VM turn\n const movedRecently = (nowTime - this.lastMovingChanged) < 50;\n const columnMoving = moving || movedRecently;\n if (!columnMoving) {\n const multiSort = sortUsingCtrl ? (event.ctrlKey || event.metaKey) : event.shiftKey;\n this.params.progressSort(multiSort);\n }\n });\n }\n const onSortingChanged = () => {\n this.addOrRemoveCssClass('ag-header-cell-sorted-asc', this.params.column.isSortAscending());\n this.addOrRemoveCssClass('ag-header-cell-sorted-desc', this.params.column.isSortDescending());\n this.addOrRemoveCssClass('ag-header-cell-sorted-none', this.params.column.isSortNone());\n if (this.params.column.getColDef().showRowGroup) {\n const sourceColumns = this.columnModel.getSourceColumnsForGroupColumn(this.params.column);\n // this == is intentional, as it allows null and undefined to match, which are both unsorted states\n const sortDirectionsMatch = sourceColumns === null || sourceColumns === void 0 ? void 0 : sourceColumns.every(sourceCol => this.params.column.getSort() == sourceCol.getSort());\n const isMultiSorting = !sortDirectionsMatch;\n this.addOrRemoveCssClass('ag-header-cell-sorted-mixed', isMultiSorting);\n }\n };\n this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, onSortingChanged);\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, onSortingChanged);\n }\n setupFilterIcon() {\n if (!this.eFilter) {\n return;\n }\n this.addManagedListener(this.params.column, Column.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));\n this.onFilterChanged();\n }\n onFilterChanged() {\n const filterPresent = this.params.column.isFilterActive();\n setDisplayed(this.eFilter, filterPresent, { skipAriaHidden: true });\n }\n}\nHeaderComp.TEMPLATE = `
\n \n
\n \n \n \n
\n
`;\n__decorate([\n Autowired('sortController')\n], HeaderComp.prototype, \"sortController\", void 0);\n__decorate([\n Autowired('menuFactory')\n], HeaderComp.prototype, \"menuFactory\", void 0);\n__decorate([\n Autowired('columnModel')\n], HeaderComp.prototype, \"columnModel\", void 0);\n__decorate([\n RefSelector('eFilter')\n], HeaderComp.prototype, \"eFilter\", void 0);\n__decorate([\n RefSelector('eSortIndicator')\n], HeaderComp.prototype, \"eSortIndicator\", void 0);\n__decorate([\n RefSelector('eMenu')\n], HeaderComp.prototype, \"eMenu\", void 0);\n__decorate([\n RefSelector('eLabel')\n], HeaderComp.prototype, \"eLabel\", void 0);\n__decorate([\n RefSelector('eText')\n], HeaderComp.prototype, \"eText\", void 0);\n__decorate([\n RefSelector('eSortOrder')\n], HeaderComp.prototype, \"eSortOrder\", void 0);\n__decorate([\n RefSelector('eSortAsc')\n], HeaderComp.prototype, \"eSortAsc\", void 0);\n__decorate([\n RefSelector('eSortDesc')\n], HeaderComp.prototype, \"eSortDesc\", void 0);\n__decorate([\n RefSelector('eSortMixed')\n], HeaderComp.prototype, \"eSortMixed\", void 0);\n__decorate([\n RefSelector('eSortNone')\n], HeaderComp.prototype, \"eSortNone\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired } from \"../../../context/context.mjs\";\nimport { ProvidedColumnGroup } from \"../../../entities/providedColumnGroup.mjs\";\nimport { setDisplayed } from \"../../../utils/dom.mjs\";\nimport { isStopPropagationForAgGrid, stopPropagationForAgGrid } from \"../../../utils/event.mjs\";\nimport { doOnce } from \"../../../utils/function.mjs\";\nimport { exists } from \"../../../utils/generic.mjs\";\nimport { createIconNoSpan } from \"../../../utils/icon.mjs\";\nimport { escapeString } from \"../../../utils/string.mjs\";\nimport { Component } from \"../../../widgets/component.mjs\";\nimport { RefSelector } from \"../../../widgets/componentAnnotations.mjs\";\nimport { TouchListener } from \"../../../widgets/touchListener.mjs\";\nexport class HeaderGroupComp extends Component {\n constructor() {\n super(HeaderGroupComp.TEMPLATE);\n }\n // this is a user component, and IComponent has \"public destroy()\" as part of the interface.\n // so we need to override destroy() just to make the method public.\n destroy() {\n super.destroy();\n }\n init(params) {\n this.params = params;\n this.checkWarnings();\n this.setupLabel();\n this.addGroupExpandIcon();\n this.setupExpandIcons();\n }\n checkWarnings() {\n const paramsAny = this.params;\n if (paramsAny.template) {\n const message = `AG Grid: A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)`;\n doOnce(() => console.warn(message), 'HeaderGroupComp.templateNotSupported');\n }\n }\n setupExpandIcons() {\n this.addInIcon(\"columnGroupOpened\", \"agOpened\");\n this.addInIcon(\"columnGroupClosed\", \"agClosed\");\n const expandAction = (event) => {\n if (isStopPropagationForAgGrid(event)) {\n return;\n }\n const newExpandedValue = !this.params.columnGroup.isExpanded();\n this.columnModel.setColumnGroupOpened(this.params.columnGroup.getProvidedColumnGroup(), newExpandedValue, \"uiColumnExpanded\");\n };\n this.addTouchAndClickListeners(this.eCloseIcon, expandAction);\n this.addTouchAndClickListeners(this.eOpenIcon, expandAction);\n const stopPropagationAction = (event) => {\n stopPropagationForAgGrid(event);\n };\n // adding stopPropagation to the double click for the icons prevents double click action happening\n // when the icons are clicked. if the icons are double clicked, then the groups should open and\n // then close again straight away. if we also listened to double click, then the group would open,\n // close, then open, which is not what we want. double click should only action if the user double\n // clicks outside of the icons.\n this.addManagedListener(this.eCloseIcon, \"dblclick\", stopPropagationAction);\n this.addManagedListener(this.eOpenIcon, \"dblclick\", stopPropagationAction);\n this.addManagedListener(this.getGui(), \"dblclick\", expandAction);\n this.updateIconVisibility();\n const providedColumnGroup = this.params.columnGroup.getProvidedColumnGroup();\n this.addManagedListener(providedColumnGroup, ProvidedColumnGroup.EVENT_EXPANDED_CHANGED, this.updateIconVisibility.bind(this));\n this.addManagedListener(providedColumnGroup, ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED, this.updateIconVisibility.bind(this));\n }\n addTouchAndClickListeners(eElement, action) {\n const touchListener = new TouchListener(eElement, true);\n this.addManagedListener(touchListener, TouchListener.EVENT_TAP, action);\n this.addDestroyFunc(() => touchListener.destroy());\n this.addManagedListener(eElement, \"click\", action);\n }\n updateIconVisibility() {\n const columnGroup = this.params.columnGroup;\n if (columnGroup.isExpandable()) {\n const expanded = this.params.columnGroup.isExpanded();\n setDisplayed(this.eOpenIcon, expanded);\n setDisplayed(this.eCloseIcon, !expanded);\n }\n else {\n setDisplayed(this.eOpenIcon, false);\n setDisplayed(this.eCloseIcon, false);\n }\n }\n addInIcon(iconName, refName) {\n const eIcon = createIconNoSpan(iconName, this.gridOptionsService, null);\n if (eIcon) {\n this.getRefElement(refName).appendChild(eIcon);\n }\n }\n addGroupExpandIcon() {\n if (!this.params.columnGroup.isExpandable()) {\n setDisplayed(this.eOpenIcon, false);\n setDisplayed(this.eCloseIcon, false);\n return;\n }\n }\n setupLabel() {\n var _a;\n // no renderer, default text render\n const { displayName, columnGroup } = this.params;\n if (exists(displayName)) {\n const displayNameSanitised = escapeString(displayName);\n this.getRefElement('agLabel').innerHTML = displayNameSanitised;\n }\n this.addOrRemoveCssClass('ag-sticky-label', !((_a = columnGroup.getColGroupDef()) === null || _a === void 0 ? void 0 : _a.suppressStickyLabel));\n }\n}\nHeaderGroupComp.TEMPLATE = `
\n \n \n \n
`;\n__decorate([\n Autowired(\"columnModel\")\n], HeaderGroupComp.prototype, \"columnModel\", void 0);\n__decorate([\n RefSelector(\"agOpened\")\n], HeaderGroupComp.prototype, \"eOpenIcon\", void 0);\n__decorate([\n RefSelector(\"agClosed\")\n], HeaderGroupComp.prototype, \"eCloseIcon\", void 0);\n","import { Component } from \"./component.mjs\";\nexport class PopupComponent extends Component {\n isPopup() {\n return true;\n }\n setParentComponent(container) {\n container.addCssClass('ag-has-popup');\n super.setParentComponent(container);\n }\n destroy() {\n const parentComp = this.parentComponent;\n const hasParent = parentComp && parentComp.isAlive();\n if (hasParent) {\n parentComp.getGui().classList.remove('ag-has-popup');\n }\n super.destroy();\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PopupComponent } from \"../../widgets/popupComponent.mjs\";\nimport { RefSelector } from \"../../widgets/componentAnnotations.mjs\";\nimport { exists } from \"../../utils/generic.mjs\";\nimport { KeyCode } from '../../constants/keyCode.mjs';\nexport class LargeTextCellEditor extends PopupComponent {\n constructor() {\n super(LargeTextCellEditor.TEMPLATE);\n }\n init(params) {\n this.params = params;\n this.focusAfterAttached = params.cellStartedEdit;\n this.eTextArea\n .setMaxLength(params.maxLength || 200)\n .setCols(params.cols || 60)\n .setRows(params.rows || 10);\n if (exists(params.value, true)) {\n this.eTextArea.setValue(params.value.toString(), true);\n }\n this.addGuiEventListener('keydown', this.onKeyDown.bind(this));\n this.activateTabIndex();\n }\n onKeyDown(event) {\n const key = event.key;\n if (key === KeyCode.LEFT ||\n key === KeyCode.UP ||\n key === KeyCode.RIGHT ||\n key === KeyCode.DOWN ||\n (event.shiftKey && key === KeyCode.ENTER)) { // shift+enter allows for newlines\n event.stopPropagation();\n }\n }\n afterGuiAttached() {\n const translate = this.localeService.getLocaleTextFunc();\n this.eTextArea.setInputAriaLabel(translate('ariaInputEditor', 'Input Editor'));\n if (this.focusAfterAttached) {\n this.eTextArea.getFocusableElement().focus();\n }\n }\n getValue() {\n const value = this.eTextArea.getValue();\n if (!exists(value) && !exists(this.params.value)) {\n return this.params.value;\n }\n return this.params.parseValue(value);\n }\n}\nLargeTextCellEditor.TEMPLATE = `
\n \n
`;\n__decorate([\n RefSelector(\"eTextArea\")\n], LargeTextCellEditor.prototype, \"eTextArea\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { AgSelect } from \"../../widgets/agSelect.mjs\";\nimport { Autowired } from \"../../context/context.mjs\";\nimport { PopupComponent } from \"../../widgets/popupComponent.mjs\";\nimport { RefSelector } from \"../../widgets/componentAnnotations.mjs\";\nimport { missing } from \"../../utils/generic.mjs\";\nimport { KeyCode } from '../../constants/keyCode.mjs';\nexport class SelectCellEditor extends PopupComponent {\n constructor() {\n super(/* html */ `
\n \n
`);\n this.startedByEnter = false;\n }\n init(params) {\n this.focusAfterAttached = params.cellStartedEdit;\n const { values, value, eventKey } = params;\n if (missing(values)) {\n console.warn('AG Grid: no values found for select cellEditor');\n return;\n }\n this.startedByEnter = eventKey != null ? eventKey === KeyCode.ENTER : false;\n let hasValue = false;\n values.forEach((currentValue) => {\n const option = { value: currentValue };\n const valueFormatted = this.valueFormatterService.formatValue(params.column, null, currentValue);\n const valueFormattedExits = valueFormatted !== null && valueFormatted !== undefined;\n option.text = valueFormattedExits ? valueFormatted : currentValue;\n this.eSelect.addOption(option);\n hasValue = hasValue || value === currentValue;\n });\n if (hasValue) {\n this.eSelect.setValue(params.value, true);\n }\n else if (params.values.length) {\n this.eSelect.setValue(params.values[0], true);\n }\n if (params.valueListGap != null) {\n this.eSelect.setPickerGap(params.valueListGap);\n }\n // we don't want to add this if full row editing, otherwise selecting will stop the\n // full row editing.\n if (this.gridOptionsService.get('editType') !== 'fullRow') {\n this.addManagedListener(this.eSelect, AgSelect.EVENT_ITEM_SELECTED, () => params.stopEditing());\n }\n }\n afterGuiAttached() {\n if (this.focusAfterAttached) {\n this.eSelect.getFocusableElement().focus();\n }\n if (this.startedByEnter) {\n setTimeout(() => {\n if (this.isAlive()) {\n this.eSelect.showPicker();\n }\n });\n }\n }\n focusIn() {\n this.eSelect.getFocusableElement().focus();\n }\n getValue() {\n return this.eSelect.getValue();\n }\n isPopup() {\n return false;\n }\n}\n__decorate([\n Autowired('valueFormatterService')\n], SelectCellEditor.prototype, \"valueFormatterService\", void 0);\n__decorate([\n RefSelector('eSelect')\n], SelectCellEditor.prototype, \"eSelect\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PopupComponent } from \"../../widgets/popupComponent.mjs\";\nimport { RefSelector } from \"../../widgets/componentAnnotations.mjs\";\nimport { isBrowserSafari } from \"../../utils/browser.mjs\";\nimport { KeyCode } from '../../constants/keyCode.mjs';\nexport class SimpleCellEditor extends PopupComponent {\n constructor(cellEditorInput) {\n super(/* html */ `\n
\n ${cellEditorInput.getTemplate()}\n
`);\n this.cellEditorInput = cellEditorInput;\n }\n init(params) {\n this.params = params;\n const eInput = this.eInput;\n this.cellEditorInput.init(eInput, params);\n let startValue;\n // cellStartedEdit is only false if we are doing fullRow editing\n if (params.cellStartedEdit) {\n this.focusAfterAttached = true;\n const eventKey = params.eventKey;\n if (eventKey === KeyCode.BACKSPACE || params.eventKey === KeyCode.DELETE) {\n startValue = '';\n }\n else if (eventKey && eventKey.length === 1) {\n startValue = eventKey;\n }\n else {\n startValue = this.cellEditorInput.getStartValue();\n if (eventKey !== KeyCode.F2) {\n this.highlightAllOnFocus = true;\n }\n }\n }\n else {\n this.focusAfterAttached = false;\n startValue = this.cellEditorInput.getStartValue();\n }\n if (startValue != null) {\n eInput.setStartValue(startValue);\n }\n this.addManagedListener(eInput.getGui(), 'keydown', (event) => {\n const { key } = event;\n if (key === KeyCode.PAGE_UP || key === KeyCode.PAGE_DOWN) {\n event.preventDefault();\n }\n });\n }\n afterGuiAttached() {\n var _a, _b;\n const translate = this.localeService.getLocaleTextFunc();\n const eInput = this.eInput;\n eInput.setInputAriaLabel(translate('ariaInputEditor', 'Input Editor'));\n if (!this.focusAfterAttached) {\n return;\n }\n // Added for AG-3238. We can't remove this explicit focus() because Chrome requires an input\n // to be focused before setSelectionRange will work. But it triggers a bug in Safari where\n // explicitly focusing then blurring an empty field will cause the parent container to scroll.\n if (!isBrowserSafari()) {\n eInput.getFocusableElement().focus();\n }\n const inputEl = eInput.getInputElement();\n if (this.highlightAllOnFocus) {\n inputEl.select();\n }\n else {\n (_b = (_a = this.cellEditorInput).setCaret) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n }\n // gets called when tabbing through cells and in full row edit mode\n focusIn() {\n const eInput = this.eInput;\n const focusEl = eInput.getFocusableElement();\n const inputEl = eInput.getInputElement();\n focusEl.focus();\n inputEl.select();\n }\n getValue() {\n return this.cellEditorInput.getValue();\n }\n isPopup() {\n return false;\n }\n}\n__decorate([\n RefSelector('eInput')\n], SimpleCellEditor.prototype, \"eInput\", void 0);\n","import { SimpleCellEditor } from \"./simpleCellEditor.mjs\";\nimport { exists } from \"../../utils/generic.mjs\";\nclass TextCellEditorInput {\n getTemplate() {\n return /* html */ ``;\n }\n init(eInput, params) {\n this.eInput = eInput;\n this.params = params;\n if (params.maxLength != null) {\n eInput.setMaxLength(params.maxLength);\n }\n }\n getValue() {\n const value = this.eInput.getValue();\n if (!exists(value) && !exists(this.params.value)) {\n return this.params.value;\n }\n return this.params.parseValue(value);\n }\n getStartValue() {\n const formatValue = this.params.useFormatter || this.params.column.getColDef().refData;\n return formatValue ? this.params.formatValue(this.params.value) : this.params.value;\n }\n setCaret() {\n // when we started editing, we want the caret at the end, not the start.\n // this comes into play in two scenarios:\n // a) when user hits F2\n // b) when user hits a printable character\n const value = this.eInput.getValue();\n const len = (exists(value) && value.length) || 0;\n if (len) {\n this.eInput.getInputElement().setSelectionRange(len, len);\n }\n }\n}\nexport class TextCellEditor extends SimpleCellEditor {\n constructor() {\n super(new TextCellEditorInput());\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired } from \"../../context/context.mjs\";\nimport { Component } from \"../../widgets/component.mjs\";\nimport { exists } from \"../../utils/generic.mjs\";\nimport { clearElement } from \"../../utils/dom.mjs\";\nconst ARROW_UP = '\\u2191';\nconst ARROW_DOWN = '\\u2193';\nexport class AnimateShowChangeCellRenderer extends Component {\n constructor() {\n super(AnimateShowChangeCellRenderer.TEMPLATE);\n this.refreshCount = 0;\n }\n init(params) {\n // this.params = params;\n this.eValue = this.queryForHtmlElement('.ag-value-change-value');\n this.eDelta = this.queryForHtmlElement('.ag-value-change-delta');\n this.refresh(params);\n }\n showDelta(params, delta) {\n const absDelta = Math.abs(delta);\n const valueFormatted = params.formatValue(absDelta);\n const valueToUse = exists(valueFormatted) ? valueFormatted : absDelta;\n const deltaUp = (delta >= 0);\n if (deltaUp) {\n this.eDelta.innerHTML = ARROW_UP + valueToUse;\n }\n else {\n // because negative, use ABS to remove sign\n this.eDelta.innerHTML = ARROW_DOWN + valueToUse;\n }\n this.eDelta.classList.toggle('ag-value-change-delta-up', deltaUp);\n this.eDelta.classList.toggle('ag-value-change-delta-down', !deltaUp);\n }\n setTimerToRemoveDelta() {\n // the refreshCount makes sure that if the value updates again while\n // the below timer is waiting, then the below timer will realise it\n // is not the most recent and will not try to remove the delta value.\n this.refreshCount++;\n const refreshCountCopy = this.refreshCount;\n window.setTimeout(() => {\n if (refreshCountCopy === this.refreshCount) {\n this.hideDeltaValue();\n }\n }, 2000);\n }\n hideDeltaValue() {\n this.eValue.classList.remove('ag-value-change-value-highlight');\n clearElement(this.eDelta);\n }\n refresh(params) {\n const value = params.value;\n if (value === this.lastValue) {\n return false;\n }\n if (exists(params.valueFormatted)) {\n this.eValue.innerHTML = params.valueFormatted;\n }\n else if (exists(params.value)) {\n this.eValue.innerHTML = value;\n }\n else {\n clearElement(this.eValue);\n }\n // we don't show the delta if we are in the middle of a filter. see comment on FilterManager\n // with regards processingFilterChange\n if (this.filterManager.isSuppressFlashingCellsBecauseFiltering()) {\n return false;\n }\n if (typeof value === 'number' && typeof this.lastValue === 'number') {\n const delta = value - this.lastValue;\n this.showDelta(params, delta);\n }\n // highlight the current value, but only if it's not new, otherwise it\n // would get highlighted first time the value is shown\n if (this.lastValue) {\n this.eValue.classList.add('ag-value-change-value-highlight');\n }\n this.setTimerToRemoveDelta();\n this.lastValue = value;\n return true;\n }\n}\nAnimateShowChangeCellRenderer.TEMPLATE = '' +\n '' +\n '' +\n '';\n__decorate([\n Autowired('filterManager')\n], AnimateShowChangeCellRenderer.prototype, \"filterManager\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired } from \"../../context/context.mjs\";\nimport { Component } from \"../../widgets/component.mjs\";\nimport { loadTemplate, clearElement } from \"../../utils/dom.mjs\";\nimport { missing, exists } from \"../../utils/generic.mjs\";\nexport class AnimateSlideCellRenderer extends Component {\n constructor() {\n super(AnimateSlideCellRenderer.TEMPLATE);\n this.refreshCount = 0;\n this.eCurrent = this.queryForHtmlElement('.ag-value-slide-current');\n }\n init(params) {\n this.refresh(params);\n }\n addSlideAnimation() {\n this.refreshCount++;\n // below we keep checking this, and stop working on the animation\n // if it no longer matches - this means another animation has started\n // and this one is stale.\n const refreshCountCopy = this.refreshCount;\n // if old animation, remove it\n if (this.ePrevious) {\n this.getGui().removeChild(this.ePrevious);\n }\n this.ePrevious = loadTemplate('');\n this.ePrevious.innerHTML = this.eCurrent.innerHTML;\n this.getGui().insertBefore(this.ePrevious, this.eCurrent);\n // having timeout of 0 allows use to skip to the next css turn,\n // so we know the previous css classes have been applied. so the\n // complex set of setTimeout below creates the animation\n window.setTimeout(() => {\n if (refreshCountCopy !== this.refreshCount) {\n return;\n }\n this.ePrevious.classList.add('ag-value-slide-out-end');\n }, 50);\n window.setTimeout(() => {\n if (refreshCountCopy !== this.refreshCount) {\n return;\n }\n this.getGui().removeChild(this.ePrevious);\n this.ePrevious = null;\n }, 3000);\n }\n refresh(params) {\n let value = params.value;\n if (missing(value)) {\n value = '';\n }\n if (value === this.lastValue) {\n return false;\n }\n // we don't show the delta if we are in the middle of a filter. see comment on FilterManager\n // with regards processingFilterChange\n if (this.filterManager.isSuppressFlashingCellsBecauseFiltering()) {\n return false;\n }\n this.addSlideAnimation();\n this.lastValue = value;\n if (exists(params.valueFormatted)) {\n this.eCurrent.innerHTML = params.valueFormatted;\n }\n else if (exists(params.value)) {\n this.eCurrent.innerHTML = value;\n }\n else {\n clearElement(this.eCurrent);\n }\n return true;\n }\n}\nAnimateSlideCellRenderer.TEMPLATE = `\n \n `;\n__decorate([\n Autowired('filterManager')\n], AnimateSlideCellRenderer.prototype, \"filterManager\", void 0);\n","import { Events } from \"../events.mjs\";\nimport { EventService } from \"../eventService.mjs\";\nimport { debounce } from \"../utils/function.mjs\";\nimport { exists, missing, missingOrEmpty } from \"../utils/generic.mjs\";\nimport { getAllKeysInObjects } from \"../utils/object.mjs\";\nexport class RowNode {\n constructor(beans) {\n /** The current row index. If the row is filtered out or in a collapsed group, this value will be `null`. */\n this.rowIndex = null;\n /** The key for the group eg Ireland, UK, USA */\n this.key = null;\n /** Children mapped by the pivot columns. */\n this.childrenMapped = {};\n /**\n * This will be `true` if it has a rowIndex assigned, otherwise `false`.\n */\n this.displayed = false;\n /** The row top position in pixels. */\n this.rowTop = null;\n /** The top pixel for this row last time, makes sense if data set was ordered or filtered,\n * it is used so new rows can animate in from their old position. */\n this.oldRowTop = null;\n /** `true` by default - can be overridden via gridOptions.isRowSelectable(rowNode) */\n this.selectable = true;\n /** Used by sorting service - to give deterministic sort to groups. Previously we\n * just id for this, however id is a string and had slower sorting compared to numbers. */\n this.__objectId = RowNode.OBJECT_ID_SEQUENCE++;\n /** When one or more Columns are using autoHeight, this keeps track of height of each autoHeight Cell,\n * indexed by the Column ID. */\n this.__autoHeights = {};\n /** `true` when nodes with the same id are being removed and added as part of the same batch transaction */\n this.alreadyRendered = false;\n this.highlighted = null;\n this.hovered = false;\n this.selected = false;\n this.beans = beans;\n }\n /**\n * Replaces the data on the `rowNode`. When this method is called, the grid will refresh the entire rendered row if it is displayed.\n */\n setData(data) {\n this.setDataCommon(data, false);\n }\n // similar to setRowData, however it is expected that the data is the same data item. this\n // is intended to be used with Redux type stores, where the whole data can be changed. we are\n // guaranteed that the data is the same entity (so grid doesn't need to worry about the id of the\n // underlying data changing, hence doesn't need to worry about selection). the grid, upon receiving\n // dataChanged event, will refresh the cells rather than rip them all out (so user can show transitions).\n /**\n * Updates the data on the `rowNode`. When this method is called, the grid will refresh the entire rendered row if it is displayed.\n */\n updateData(data) {\n this.setDataCommon(data, true);\n }\n setDataCommon(data, update) {\n const oldData = this.data;\n this.data = data;\n this.beans.valueCache.onDataChanged();\n this.updateDataOnDetailNode();\n this.checkRowSelectable();\n this.resetQuickFilterAggregateText();\n const event = this.createDataChangedEvent(data, oldData, update);\n this.dispatchLocalEvent(event);\n }\n // when we are doing master / detail, the detail node is lazy created, but then kept around.\n // so if we show / hide the detail, the same detail rowNode is used. so we need to keep the data\n // in sync, otherwise expand/collapse of the detail would still show the old values.\n updateDataOnDetailNode() {\n if (this.detailNode) {\n this.detailNode.data = this.data;\n }\n }\n createDataChangedEvent(newData, oldData, update) {\n return {\n type: RowNode.EVENT_DATA_CHANGED,\n node: this,\n oldData: oldData,\n newData: newData,\n update: update\n };\n }\n createLocalRowEvent(type) {\n return {\n type: type,\n node: this\n };\n }\n getRowIndexString() {\n if (this.rowPinned === 'top') {\n return 't-' + this.rowIndex;\n }\n if (this.rowPinned === 'bottom') {\n return 'b-' + this.rowIndex;\n }\n return this.rowIndex.toString();\n }\n createDaemonNode() {\n const oldNode = new RowNode(this.beans);\n // just copy the id and data, this is enough for the node to be used\n // in the selection controller (the selection controller is the only\n // place where daemon nodes can live).\n oldNode.id = this.id;\n oldNode.data = this.data;\n oldNode.__daemon = true;\n oldNode.selected = this.selected;\n oldNode.level = this.level;\n return oldNode;\n }\n setDataAndId(data, id) {\n const oldNode = exists(this.id) ? this.createDaemonNode() : null;\n const oldData = this.data;\n this.data = data;\n this.updateDataOnDetailNode();\n this.setId(id);\n this.checkRowSelectable();\n this.beans.selectionService.syncInRowNode(this, oldNode);\n const event = this.createDataChangedEvent(data, oldData, false);\n this.dispatchLocalEvent(event);\n }\n checkRowSelectable() {\n const isRowSelectableFunc = this.beans.gridOptionsService.get('isRowSelectable');\n this.setRowSelectable(isRowSelectableFunc ? isRowSelectableFunc(this) : true);\n }\n setRowSelectable(newVal) {\n if (this.selectable !== newVal) {\n this.selectable = newVal;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_SELECTABLE_CHANGED));\n }\n const isGroupSelectsChildren = this.beans.gridOptionsService.is('groupSelectsChildren');\n if (isGroupSelectsChildren) {\n const selected = this.calculateSelectedFromChildren();\n this.setSelectedParams({\n newValue: selected !== null && selected !== void 0 ? selected : false,\n source: 'selectableChanged',\n });\n }\n }\n }\n setId(id) {\n // see if user is providing the id's\n const getRowIdFunc = this.beans.gridOptionsService.getCallback('getRowId');\n if (getRowIdFunc) {\n // if user is providing the id's, then we set the id only after the data has been set.\n // this is important for virtual pagination and viewport, where empty rows exist.\n if (this.data) {\n // we pass 'true' as we skip this level when generating keys,\n // as we don't always have the key for this level (eg when updating\n // data via transaction on SSRM, we are getting key to look up the\n // RowNode, don't have the RowNode yet, thus no way to get the current key)\n const parentKeys = this.getGroupKeys(true);\n this.id = getRowIdFunc({\n data: this.data,\n parentKeys: parentKeys.length > 0 ? parentKeys : undefined,\n level: this.level\n });\n // make sure id provided doesn't start with 'row-group-' as this is reserved. also check that\n // it has 'startsWith' in case the user provided a number.\n if (this.id !== null && typeof this.id === 'string' && this.id.startsWith(RowNode.ID_PREFIX_ROW_GROUP)) {\n console.error(`AG Grid: Row IDs cannot start with ${RowNode.ID_PREFIX_ROW_GROUP}, this is a reserved prefix for AG Grid's row grouping feature.`);\n }\n // force id to be a string\n if (this.id !== null && typeof this.id !== 'string') {\n this.id = '' + this.id;\n }\n }\n else {\n // this can happen if user has set blank into the rowNode after the row previously\n // having data. this happens in virtual page row model, when data is delete and\n // the page is refreshed.\n this.id = undefined;\n }\n }\n else {\n this.id = id;\n }\n }\n getGroupKeys(excludeSelf = false) {\n const keys = [];\n let pointer = this;\n if (excludeSelf) {\n pointer = pointer.parent;\n }\n while (pointer && pointer.level >= 0) {\n keys.push(pointer.key);\n pointer = pointer.parent;\n }\n keys.reverse();\n return keys;\n }\n isPixelInRange(pixel) {\n if (!exists(this.rowTop) || !exists(this.rowHeight)) {\n return false;\n }\n return pixel >= this.rowTop && pixel < (this.rowTop + this.rowHeight);\n }\n setFirstChild(firstChild) {\n if (this.firstChild === firstChild) {\n return;\n }\n this.firstChild = firstChild;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_FIRST_CHILD_CHANGED));\n }\n }\n setLastChild(lastChild) {\n if (this.lastChild === lastChild) {\n return;\n }\n this.lastChild = lastChild;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_LAST_CHILD_CHANGED));\n }\n }\n setChildIndex(childIndex) {\n if (this.childIndex === childIndex) {\n return;\n }\n this.childIndex = childIndex;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_CHILD_INDEX_CHANGED));\n }\n }\n setRowTop(rowTop) {\n this.oldRowTop = this.rowTop;\n if (this.rowTop === rowTop) {\n return;\n }\n this.rowTop = rowTop;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_TOP_CHANGED));\n }\n this.setDisplayed(rowTop !== null);\n }\n clearRowTopAndRowIndex() {\n this.oldRowTop = null;\n this.setRowTop(null);\n this.setRowIndex(null);\n }\n setDisplayed(displayed) {\n if (this.displayed === displayed) {\n return;\n }\n this.displayed = displayed;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_DISPLAYED_CHANGED));\n }\n }\n setDragging(dragging) {\n if (this.dragging === dragging) {\n return;\n }\n this.dragging = dragging;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_DRAGGING_CHANGED));\n }\n }\n setHighlighted(highlighted) {\n if (highlighted === this.highlighted) {\n return;\n }\n this.highlighted = highlighted;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HIGHLIGHT_CHANGED));\n }\n }\n setHovered(hovered) {\n if (this.hovered === hovered) {\n return;\n }\n this.hovered = hovered;\n }\n isHovered() {\n return this.hovered;\n }\n setAllChildrenCount(allChildrenCount) {\n if (this.allChildrenCount === allChildrenCount) {\n return;\n }\n this.allChildrenCount = allChildrenCount;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED));\n }\n }\n setMaster(master) {\n if (this.master === master) {\n return;\n }\n // if changing AWAY from master, then unexpand, otherwise\n // next time it's shown it is expanded again\n if (this.master && !master) {\n this.expanded = false;\n }\n this.master = master;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_MASTER_CHANGED));\n }\n }\n setGroup(group) {\n if (this.group === group) {\n return;\n }\n // if we used to be a group, and no longer, then close the node\n if (this.group && !group) {\n this.expanded = false;\n }\n this.group = group;\n this.updateHasChildren();\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_GROUP_CHANGED));\n }\n }\n /**\n * Sets the row height.\n * Call if you want to change the height initially assigned to the row.\n * After calling, you must call `api.onRowHeightChanged()` so the grid knows it needs to work out the placement of the rows. */\n setRowHeight(rowHeight, estimated = false) {\n this.rowHeight = rowHeight;\n this.rowHeightEstimated = estimated;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HEIGHT_CHANGED));\n }\n }\n setRowAutoHeight(cellHeight, column) {\n if (!this.__autoHeights) {\n this.__autoHeights = {};\n }\n this.__autoHeights[column.getId()] = cellHeight;\n if (cellHeight != null) {\n if (this.checkAutoHeightsDebounced == null) {\n this.checkAutoHeightsDebounced = debounce(this.checkAutoHeights.bind(this), 1);\n }\n this.checkAutoHeightsDebounced();\n }\n }\n checkAutoHeights() {\n let notAllPresent = false;\n let nonePresent = true;\n let newRowHeight = 0;\n const autoHeights = this.__autoHeights;\n if (autoHeights == null) {\n return;\n }\n const displayedAutoHeightCols = this.beans.columnModel.getAllDisplayedAutoHeightCols();\n displayedAutoHeightCols.forEach(col => {\n let cellHeight = autoHeights[col.getId()];\n if (cellHeight == null) {\n // If column spanning is active a column may not provide auto height for a row if that\n // cell is not present for the given row due to a previous cell spanning over the auto height column.\n if (this.beans.columnModel.isColSpanActive()) {\n let activeColsForRow = [];\n switch (col.getPinned()) {\n case 'left':\n activeColsForRow = this.beans.columnModel.getDisplayedLeftColumnsForRow(this);\n break;\n case 'right':\n activeColsForRow = this.beans.columnModel.getDisplayedRightColumnsForRow(this);\n break;\n case null:\n activeColsForRow = this.beans.columnModel.getViewportCenterColumnsForRow(this);\n break;\n }\n if (activeColsForRow.includes(col)) {\n // Column is present in the row, i.e not spanned over, but no auto height was provided so we cannot calculate the row height\n notAllPresent = true;\n return;\n }\n // Ignore this column as it is spanned over and not present in the row\n cellHeight = -1;\n }\n else {\n notAllPresent = true;\n return;\n }\n }\n else {\n // At least one auto height is present\n nonePresent = false;\n }\n if (cellHeight > newRowHeight) {\n newRowHeight = cellHeight;\n }\n });\n if (notAllPresent) {\n return;\n }\n // we take min of 10, so we don't adjust for empty rows. if <10, we put to default.\n // this prevents the row starting very small when waiting for async components,\n // which would then mean the grid squashes in far to many rows (as small heights\n // means more rows fit in) which looks crap. so best ignore small values and assume\n // we are still waiting for values to render.\n if (nonePresent || newRowHeight < 10) {\n newRowHeight = this.beans.gridOptionsService.getRowHeightForNode(this).height;\n }\n if (newRowHeight == this.rowHeight) {\n return;\n }\n this.setRowHeight(newRowHeight);\n const rowModel = this.beans.rowModel;\n if (rowModel.onRowHeightChangedDebounced) {\n rowModel.onRowHeightChangedDebounced();\n }\n }\n setRowIndex(rowIndex) {\n if (this.rowIndex === rowIndex) {\n return;\n }\n this.rowIndex = rowIndex;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_ROW_INDEX_CHANGED));\n }\n }\n setUiLevel(uiLevel) {\n if (this.uiLevel === uiLevel) {\n return;\n }\n this.uiLevel = uiLevel;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_UI_LEVEL_CHANGED));\n }\n }\n /**\n * Set the expanded state of this rowNode. Pass `true` to expand and `false` to collapse.\n */\n setExpanded(expanded, e) {\n if (this.expanded === expanded) {\n return;\n }\n this.expanded = expanded;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_EXPANDED_CHANGED));\n }\n const event = Object.assign({}, this.createGlobalRowEvent(Events.EVENT_ROW_GROUP_OPENED), {\n expanded,\n event: e || null\n });\n this.beans.rowNodeEventThrottle.dispatchExpanded(event);\n // when using footers we need to refresh the group row, as the aggregation\n // values jump between group and footer\n if (this.beans.gridOptionsService.is('groupIncludeFooter')) {\n this.beans.rowRenderer.refreshCells({ rowNodes: [this] });\n }\n }\n createGlobalRowEvent(type) {\n return {\n type: type,\n node: this,\n data: this.data,\n rowIndex: this.rowIndex,\n rowPinned: this.rowPinned,\n context: this.beans.gridOptionsService.context,\n api: this.beans.gridOptionsService.api,\n columnApi: this.beans.gridOptionsService.columnApi\n };\n }\n dispatchLocalEvent(event) {\n if (this.eventService) {\n this.eventService.dispatchEvent(event);\n }\n }\n /**\n * Replaces the value on the `rowNode` for the specified column. When complete,\n * the grid will refresh the rendered cell on the required row only.\n * **Note**: This method only fires `onCellEditRequest` when the Grid is in **Read Only** mode.\n *\n * @param colKey The column where the value should be updated\n * @param newValue The new value\n * @param eventSource The source of the event\n * @returns `true` if the value was changed, otherwise `false`.\n */\n setDataValue(colKey, newValue, eventSource) {\n const getColumnFromKey = () => {\n var _a;\n if (typeof colKey !== 'string') {\n return colKey;\n }\n // if in pivot mode, grid columns wont include primary columns\n return (_a = this.beans.columnModel.getGridColumn(colKey)) !== null && _a !== void 0 ? _a : this.beans.columnModel.getPrimaryColumn(colKey);\n };\n // When it is done via the editors, no 'cell changed' event gets fired, as it's assumed that\n // the cell knows about the change given it's in charge of the editing.\n // this method is for the client to call, so the cell listens for the change\n // event, and also flashes the cell when the change occurs.\n const column = getColumnFromKey();\n const oldValue = this.getValueFromValueService(column);\n if (this.beans.gridOptionsService.is('readOnlyEdit')) {\n this.dispatchEventForSaveValueReadOnly(column, oldValue, newValue, eventSource);\n return false;\n }\n const valueChanged = this.beans.valueService.setValue(this, column, newValue, eventSource);\n this.dispatchCellChangedEvent(column, newValue, oldValue);\n this.checkRowSelectable();\n return valueChanged;\n }\n getValueFromValueService(column) {\n // if we don't check this, then the grid will render leaf groups as open even if we are not\n // allowing the user to open leaf groups. confused? remember for pivot mode we don't allow\n // opening leaf groups, so we have to force leafGroups to be closed in case the user expanded\n // them via the API, or user user expanded them in the UI before turning on pivot mode\n const lockedClosedGroup = this.leafGroup && this.beans.columnModel.isPivotMode();\n const isOpenGroup = this.group && this.expanded && !this.footer && !lockedClosedGroup;\n // are we showing group footers\n const groupFootersEnabled = this.beans.gridOptionsService.is('groupIncludeFooter');\n // if doing footers, we normally don't show agg data at group level when group is open\n const groupAlwaysShowAggData = this.beans.gridOptionsService.is('groupSuppressBlankHeader');\n // if doing grouping and footers, we don't want to include the agg value\n // in the header when the group is open\n const ignoreAggData = (isOpenGroup && groupFootersEnabled) && !groupAlwaysShowAggData;\n const value = this.beans.valueService.getValue(column, this, false, ignoreAggData);\n return value;\n }\n dispatchEventForSaveValueReadOnly(column, oldValue, newValue, eventSource) {\n const event = {\n type: Events.EVENT_CELL_EDIT_REQUEST,\n event: null,\n rowIndex: this.rowIndex,\n rowPinned: this.rowPinned,\n column: column,\n colDef: column.getColDef(),\n context: this.beans.gridOptionsService.context,\n api: this.beans.gridOptionsService.api,\n columnApi: this.beans.gridOptionsService.columnApi,\n data: this.data,\n node: this,\n oldValue,\n newValue,\n value: newValue,\n source: eventSource\n };\n this.beans.eventService.dispatchEvent(event);\n }\n setGroupValue(colKey, newValue) {\n const column = this.beans.columnModel.getGridColumn(colKey);\n if (missing(this.groupData)) {\n this.groupData = {};\n }\n const columnId = column.getColId();\n const oldValue = this.groupData[columnId];\n if (oldValue === newValue) {\n return;\n }\n this.groupData[columnId] = newValue;\n this.dispatchCellChangedEvent(column, newValue, oldValue);\n }\n // sets the data for an aggregation\n setAggData(newAggData) {\n // find out all keys that could potentially change\n const colIds = getAllKeysInObjects([this.aggData, newAggData]);\n const oldAggData = this.aggData;\n this.aggData = newAggData;\n // if no event service, nobody has registered for events, so no need fire event\n if (this.eventService) {\n colIds.forEach(colId => {\n const column = this.beans.columnModel.getGridColumn(colId);\n const value = this.aggData ? this.aggData[colId] : undefined;\n const oldValue = oldAggData ? oldAggData[colId] : undefined;\n this.dispatchCellChangedEvent(column, value, oldValue);\n });\n }\n }\n updateHasChildren() {\n // in CSRM, the group property will be set before the childrenAfterGroup property, check both to prevent flickering\n let newValue = (this.group && !this.footer) || (this.childrenAfterGroup && this.childrenAfterGroup.length > 0);\n const isSsrm = this.beans.gridOptionsService.isRowModelType('serverSide');\n if (isSsrm) {\n const isTreeData = this.beans.gridOptionsService.isTreeData();\n const isGroupFunc = this.beans.gridOptionsService.get('isServerSideGroup');\n // stubs and footers can never have children, as they're grid rows. if tree data the presence of children\n // is determined by the isServerSideGroup callback, if not tree data then the rows group property will be set.\n newValue = !this.stub && !this.footer && (isTreeData ? !!isGroupFunc && isGroupFunc(this.data) : !!this.group);\n }\n if (newValue !== this.__hasChildren) {\n this.__hasChildren = !!newValue;\n if (this.eventService) {\n this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HAS_CHILDREN_CHANGED));\n }\n }\n }\n hasChildren() {\n if (this.__hasChildren == null) {\n this.updateHasChildren();\n }\n return this.__hasChildren;\n }\n isEmptyRowGroupNode() {\n return this.group && missingOrEmpty(this.childrenAfterGroup);\n }\n dispatchCellChangedEvent(column, newValue, oldValue) {\n const cellChangedEvent = {\n type: RowNode.EVENT_CELL_CHANGED,\n node: this,\n column: column,\n newValue: newValue,\n oldValue: oldValue\n };\n this.dispatchLocalEvent(cellChangedEvent);\n }\n /**\n * The first time `quickFilter` runs, the grid creates a one-off string representation of the row.\n * This string is then used for the quick filter instead of hitting each column separately.\n * When you edit, using grid editing, this string gets cleared down.\n * However if you edit without using grid editing, you will need to clear this string down for the row to be updated with the new values.\n * Otherwise new values will not work with the `quickFilter`. */\n resetQuickFilterAggregateText() {\n this.quickFilterAggregateText = null;\n }\n /** Returns:\n * - `true` if the node can be expanded, i.e it is a group or master row.\n * - `false` if the node cannot be expanded\n */\n isExpandable() {\n return (this.hasChildren() && !this.footer) || this.master ? true : false;\n }\n /** Returns:\n * - `true` if node is selected,\n * - `false` if the node isn't selected\n * - `undefined` if it's partially selected (group where not all children are selected). */\n isSelected() {\n // for footers, we just return what our sibling selected state is, as cannot select a footer\n if (this.footer) {\n return this.sibling.isSelected();\n }\n return this.selected;\n }\n /** Perform a depth-first search of this node and its children. */\n depthFirstSearch(callback) {\n if (this.childrenAfterGroup) {\n this.childrenAfterGroup.forEach(child => child.depthFirstSearch(callback));\n }\n callback(this);\n }\n // + selectionController.calculatedSelectedForAllGroupNodes()\n calculateSelectedFromChildren() {\n var _a;\n let atLeastOneSelected = false;\n let atLeastOneDeSelected = false;\n let atLeastOneMixed = false;\n if (!((_a = this.childrenAfterGroup) === null || _a === void 0 ? void 0 : _a.length)) {\n return this.selectable ? this.selected : null;\n }\n for (let i = 0; i < this.childrenAfterGroup.length; i++) {\n const child = this.childrenAfterGroup[i];\n let childState = child.isSelected();\n // non-selectable nodes must be calculated from their children, or ignored if no value results.\n if (!child.selectable) {\n const selectable = child.calculateSelectedFromChildren();\n if (selectable === null) {\n continue;\n }\n childState = selectable;\n }\n switch (childState) {\n case true:\n atLeastOneSelected = true;\n break;\n case false:\n atLeastOneDeSelected = true;\n break;\n default:\n atLeastOneMixed = true;\n break;\n }\n }\n if (atLeastOneMixed || (atLeastOneSelected && atLeastOneDeSelected)) {\n return undefined;\n }\n if (atLeastOneSelected) {\n return true;\n }\n if (atLeastOneDeSelected) {\n return false;\n }\n if (!this.selectable) {\n return null;\n }\n return this.selected;\n }\n setSelectedInitialValue(selected) {\n this.selected = selected;\n }\n selectThisNode(newValue, e, source = 'api') {\n // we only check selectable when newValue=true (ie selecting) to allow unselecting values,\n // as selectable is dynamic, need a way to unselect rows when selectable becomes false.\n const selectionNotAllowed = !this.selectable && newValue;\n const selectionNotChanged = this.selected === newValue;\n if (selectionNotAllowed || selectionNotChanged) {\n return false;\n }\n this.selected = newValue;\n if (this.eventService) {\n this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_ROW_SELECTED));\n }\n const event = Object.assign(Object.assign({}, this.createGlobalRowEvent(Events.EVENT_ROW_SELECTED)), { event: e || null, source });\n this.beans.eventService.dispatchEvent(event);\n return true;\n }\n /**\n * Select (or deselect) the node.\n * @param newValue -`true` for selection, `false` for deselection.\n * @param clearSelection - If selecting, then passing `true` will select the node exclusively (i.e. NOT do multi select). If doing deselection, `clearSelection` has no impact.\n * @param source - Source property that will appear in the `selectionChanged` event.\n */\n setSelected(newValue, clearSelection = false, source = 'api') {\n if (typeof source === 'boolean') {\n console.warn('AG Grid: since version v30, rowNode.setSelected() property `suppressFinishActions` has been removed, please use `gridApi.setNodesSelected()` for bulk actions, and the event `source` property for ignoring events instead.');\n return;\n }\n this.setSelectedParams({\n newValue,\n clearSelection,\n rangeSelect: false,\n source\n });\n }\n // this is for internal use only. To make calling code more readable, this is the same method as setSelected except it takes names parameters\n setSelectedParams(params) {\n if (this.rowPinned) {\n console.warn('AG Grid: cannot select pinned rows');\n return 0;\n }\n if (this.id === undefined) {\n console.warn('AG Grid: cannot select node until id for node is known');\n return 0;\n }\n return this.beans.selectionService.setNodesSelected(Object.assign(Object.assign({}, params), { nodes: [this.footer ? this.sibling : this] }));\n }\n /**\n * Returns:\n * - `true` if node is either pinned to the `top` or `bottom`\n * - `false` if the node isn't pinned\n */\n isRowPinned() {\n return this.rowPinned === 'top' || this.rowPinned === 'bottom';\n }\n isParentOfNode(potentialParent) {\n let parentNode = this.parent;\n while (parentNode) {\n if (parentNode === potentialParent) {\n return true;\n }\n parentNode = parentNode.parent;\n }\n return false;\n }\n /** Add an event listener. */\n addEventListener(eventType, listener) {\n if (!this.eventService) {\n this.eventService = new EventService();\n }\n this.eventService.addEventListener(eventType, listener);\n }\n /** Remove event listener. */\n removeEventListener(eventType, listener) {\n if (!this.eventService) {\n return;\n }\n this.eventService.removeEventListener(eventType, listener);\n if (this.eventService.noRegisteredListenersExist()) {\n this.eventService = null;\n }\n }\n onMouseEnter() {\n this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_MOUSE_ENTER));\n }\n onMouseLeave() {\n this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_MOUSE_LEAVE));\n }\n getFirstChildOfFirstChild(rowGroupColumn) {\n let currentRowNode = this;\n let isCandidate = true;\n let foundFirstChildPath = false;\n let nodeToSwapIn = null;\n // if we are hiding groups, then if we are the first child, of the first child,\n // all the way up to the column we are interested in, then we show the group cell.\n while (isCandidate && !foundFirstChildPath) {\n const parentRowNode = currentRowNode.parent;\n const firstChild = exists(parentRowNode) && currentRowNode.firstChild;\n if (firstChild) {\n if (parentRowNode.rowGroupColumn === rowGroupColumn) {\n foundFirstChildPath = true;\n nodeToSwapIn = parentRowNode;\n }\n }\n else {\n isCandidate = false;\n }\n currentRowNode = parentRowNode;\n }\n return foundFirstChildPath ? nodeToSwapIn : null;\n }\n /**\n * Returns:\n * - `true` if the node is a full width cell\n * - `false` if the node is not a full width cell\n */\n isFullWidthCell() {\n const isFullWidthCellFunc = this.beans.gridOptionsService.getCallback('isFullWidthRow');\n return isFullWidthCellFunc ? isFullWidthCellFunc({ rowNode: this }) : false;\n }\n /**\n * Returns the route of the row node. If the Row Node is a group, it returns the route to that Row Node.\n * If the Row Node is not a group, it returns `undefined`.\n */\n getRoute() {\n if (this.key == null) {\n return;\n }\n const res = [];\n let pointer = this;\n while (pointer.key != null) {\n res.push(pointer.key);\n pointer = pointer.parent;\n }\n return res.reverse();\n }\n createFooter() {\n // only create footer node once, otherwise we have daemons and\n // the animate screws up with the daemons hanging around\n if (this.sibling) {\n return;\n }\n const footerNode = new RowNode(this.beans);\n Object.keys(this).forEach(key => {\n footerNode[key] = this[key];\n });\n footerNode.footer = true;\n footerNode.setRowTop(null);\n footerNode.setRowIndex(null);\n // manually set oldRowTop to null so we discard any\n // previous information about its position.\n footerNode.oldRowTop = null;\n footerNode.id = 'rowGroupFooter_' + this.id;\n // get both header and footer to reference each other as siblings. this is never undone,\n // only overwritten. so if a group is expanded, then contracted, it will have a ghost\n // sibling - but that's fine, as we can ignore this if the header is contracted.\n footerNode.sibling = this;\n this.sibling = footerNode;\n }\n}\nRowNode.ID_PREFIX_ROW_GROUP = 'row-group-';\nRowNode.ID_PREFIX_TOP_PINNED = 't-';\nRowNode.ID_PREFIX_BOTTOM_PINNED = 'b-';\nRowNode.OBJECT_ID_SEQUENCE = 0;\nRowNode.EVENT_ROW_SELECTED = 'rowSelected';\nRowNode.EVENT_DATA_CHANGED = 'dataChanged';\nRowNode.EVENT_CELL_CHANGED = 'cellChanged';\nRowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED = 'allChildrenCountChanged';\nRowNode.EVENT_MASTER_CHANGED = 'masterChanged';\nRowNode.EVENT_GROUP_CHANGED = 'groupChanged';\nRowNode.EVENT_MOUSE_ENTER = 'mouseEnter';\nRowNode.EVENT_MOUSE_LEAVE = 'mouseLeave';\nRowNode.EVENT_HEIGHT_CHANGED = 'heightChanged';\nRowNode.EVENT_TOP_CHANGED = 'topChanged';\nRowNode.EVENT_DISPLAYED_CHANGED = 'displayedChanged';\nRowNode.EVENT_FIRST_CHILD_CHANGED = 'firstChildChanged';\nRowNode.EVENT_LAST_CHILD_CHANGED = 'lastChildChanged';\nRowNode.EVENT_CHILD_INDEX_CHANGED = 'childIndexChanged';\nRowNode.EVENT_ROW_INDEX_CHANGED = 'rowIndexChanged';\nRowNode.EVENT_EXPANDED_CHANGED = 'expandedChanged';\nRowNode.EVENT_HAS_CHILDREN_CHANGED = 'hasChildrenChanged';\nRowNode.EVENT_SELECTABLE_CHANGED = 'selectableChanged';\nRowNode.EVENT_UI_LEVEL_CHANGED = 'uiLevelChanged';\nRowNode.EVENT_HIGHLIGHT_CHANGED = 'rowHighlightChanged';\nRowNode.EVENT_DRAGGING_CHANGED = 'draggingChanged';\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PostConstruct } from '../context/context.mjs';\nimport { Component } from '../widgets/component.mjs';\nimport { Events } from '../events.mjs';\nimport { RefSelector } from '../widgets/componentAnnotations.mjs';\nimport { RowNode } from '../entities/rowNode.mjs';\nimport { stopPropagationForAgGrid } from '../utils/event.mjs';\nimport { getAriaCheckboxStateName, setAriaLive } from '../utils/aria.mjs';\nexport class CheckboxSelectionComponent extends Component {\n constructor() {\n super(/* html*/ `\n
\n \n
`);\n }\n postConstruct() {\n this.eCheckbox.setPassive(true);\n setAriaLive(this.eCheckbox.getInputElement(), 'polite');\n }\n getCheckboxId() {\n return this.eCheckbox.getInputElement().id;\n }\n onDataChanged() {\n // when rows are loaded for the second time, this can impact the selection, as a row\n // could be loaded as already selected (if user scrolls down, and then up again).\n this.onSelectionChanged();\n }\n onSelectableChanged() {\n this.showOrHideSelect();\n }\n onSelectionChanged() {\n const translate = this.localeService.getLocaleTextFunc();\n const state = this.rowNode.isSelected();\n const stateName = getAriaCheckboxStateName(translate, state);\n const ariaLabel = translate('ariaRowToggleSelection', 'Press Space to toggle row selection');\n this.eCheckbox.setValue(state, true);\n this.eCheckbox.setInputAriaLabel(`${ariaLabel} (${stateName})`);\n }\n onClicked(newValue, groupSelectsFiltered, event) {\n return this.rowNode.setSelectedParams({ newValue, rangeSelect: event.shiftKey, groupSelectsFiltered, event, source: 'checkboxSelected' });\n }\n init(params) {\n this.rowNode = params.rowNode;\n this.column = params.column;\n this.overrides = params.overrides;\n this.onSelectionChanged();\n // we don't want double click on this icon to open a group\n this.addManagedListener(this.eCheckbox.getInputElement(), 'dblclick', (event) => {\n stopPropagationForAgGrid(event);\n });\n this.addManagedListener(this.eCheckbox.getInputElement(), 'click', (event) => {\n // we don't want the row clicked event to fire when selecting the checkbox, otherwise the row\n // would possibly get selected twice\n stopPropagationForAgGrid(event);\n const groupSelectsFiltered = this.gridOptionsService.is('groupSelectsFiltered');\n const isSelected = this.eCheckbox.getValue();\n if (this.shouldHandleIndeterminateState(isSelected, groupSelectsFiltered)) {\n // try toggling children to determine action.\n const result = this.onClicked(true, groupSelectsFiltered, event || {});\n if (result === 0) {\n this.onClicked(false, groupSelectsFiltered, event);\n }\n }\n else if (isSelected) {\n this.onClicked(false, groupSelectsFiltered, event);\n }\n else {\n this.onClicked(true, groupSelectsFiltered, event || {});\n }\n });\n this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_SELECTED, this.onSelectionChanged.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.onDataChanged.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_SELECTABLE_CHANGED, this.onSelectableChanged.bind(this));\n const isRowSelectableFunc = this.gridOptionsService.get('isRowSelectable');\n const checkboxVisibleIsDynamic = isRowSelectableFunc || typeof this.getIsVisible() === 'function';\n if (checkboxVisibleIsDynamic) {\n const showOrHideSelectListener = this.showOrHideSelect.bind(this);\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, showOrHideSelectListener);\n this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, showOrHideSelectListener);\n this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, showOrHideSelectListener);\n this.showOrHideSelect();\n }\n this.eCheckbox.getInputElement().setAttribute('tabindex', '-1');\n }\n shouldHandleIndeterminateState(isSelected, groupSelectsFiltered) {\n // for CSRM groupSelectsFiltered, we can get an indeterminate state where all filtered children are selected,\n // and we would expect clicking to deselect all rather than select all\n return groupSelectsFiltered &&\n (this.eCheckbox.getPreviousValue() === undefined || isSelected === undefined) &&\n this.gridOptionsService.isRowModelType('clientSide');\n }\n showOrHideSelect() {\n var _a, _b, _c, _d;\n // if the isRowSelectable() is not provided the row node is selectable by default\n let selectable = this.rowNode.selectable;\n // checkboxSelection callback is deemed a legacy solution however we will still consider it's result.\n // If selectable, then also check the colDef callback. if not selectable, this it short circuits - no need\n // to call the colDef callback.\n const isVisible = this.getIsVisible();\n if (selectable) {\n if (typeof isVisible === 'function') {\n const extraParams = (_a = this.overrides) === null || _a === void 0 ? void 0 : _a.callbackParams;\n const params = (_b = this.column) === null || _b === void 0 ? void 0 : _b.createColumnFunctionCallbackParams(this.rowNode);\n selectable = params ? isVisible(Object.assign(Object.assign({}, extraParams), params)) : false;\n }\n else {\n selectable = isVisible !== null && isVisible !== void 0 ? isVisible : false;\n }\n }\n const disableInsteadOfHide = (_c = this.column) === null || _c === void 0 ? void 0 : _c.getColDef().showDisabledCheckboxes;\n if (disableInsteadOfHide) {\n this.eCheckbox.setDisabled(!selectable);\n this.setVisible(true);\n this.setDisplayed(true);\n return;\n }\n if ((_d = this.overrides) === null || _d === void 0 ? void 0 : _d.removeHidden) {\n this.setDisplayed(selectable);\n return;\n }\n this.setVisible(selectable);\n }\n getIsVisible() {\n var _a, _b;\n if (this.overrides) {\n return this.overrides.isVisible;\n }\n // column will be missing if groupDisplayType = 'groupRows'\n return (_b = (_a = this.column) === null || _a === void 0 ? void 0 : _a.getColDef()) === null || _b === void 0 ? void 0 : _b.checkboxSelection;\n }\n}\n__decorate([\n RefSelector('eCheckbox')\n], CheckboxSelectionComponent.prototype, \"eCheckbox\", void 0);\n__decorate([\n PostConstruct\n], CheckboxSelectionComponent.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar DragAndDropService_1;\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { PostConstruct, Bean, Autowired, PreDestroy } from \"../context/context.mjs\";\nimport { escapeString } from \"../utils/string.mjs\";\nimport { createIcon } from \"../utils/icon.mjs\";\nimport { flatten, removeFromArray } from \"../utils/array.mjs\";\nimport { getBodyHeight, getBodyWidth } from \"../utils/browser.mjs\";\nimport { loadTemplate, clearElement, getElementRectWithOffset } from \"../utils/dom.mjs\";\nimport { isFunction } from \"../utils/function.mjs\";\nexport var DragSourceType;\n(function (DragSourceType) {\n DragSourceType[DragSourceType[\"ToolPanel\"] = 0] = \"ToolPanel\";\n DragSourceType[DragSourceType[\"HeaderCell\"] = 1] = \"HeaderCell\";\n DragSourceType[DragSourceType[\"RowDrag\"] = 2] = \"RowDrag\";\n DragSourceType[DragSourceType[\"ChartPanel\"] = 3] = \"ChartPanel\";\n})(DragSourceType || (DragSourceType = {}));\nexport var VerticalDirection;\n(function (VerticalDirection) {\n VerticalDirection[VerticalDirection[\"Up\"] = 0] = \"Up\";\n VerticalDirection[VerticalDirection[\"Down\"] = 1] = \"Down\";\n})(VerticalDirection || (VerticalDirection = {}));\nexport var HorizontalDirection;\n(function (HorizontalDirection) {\n HorizontalDirection[HorizontalDirection[\"Left\"] = 0] = \"Left\";\n HorizontalDirection[HorizontalDirection[\"Right\"] = 1] = \"Right\";\n})(HorizontalDirection || (HorizontalDirection = {}));\nlet DragAndDropService = DragAndDropService_1 = class DragAndDropService extends BeanStub {\n constructor() {\n super(...arguments);\n this.dragSourceAndParamsList = [];\n this.dropTargets = [];\n }\n init() {\n this.ePinnedIcon = createIcon('columnMovePin', this.gridOptionsService, null);\n this.eHideIcon = createIcon('columnMoveHide', this.gridOptionsService, null);\n this.eMoveIcon = createIcon('columnMoveMove', this.gridOptionsService, null);\n this.eLeftIcon = createIcon('columnMoveLeft', this.gridOptionsService, null);\n this.eRightIcon = createIcon('columnMoveRight', this.gridOptionsService, null);\n this.eGroupIcon = createIcon('columnMoveGroup', this.gridOptionsService, null);\n this.eAggregateIcon = createIcon('columnMoveValue', this.gridOptionsService, null);\n this.ePivotIcon = createIcon('columnMovePivot', this.gridOptionsService, null);\n this.eDropNotAllowedIcon = createIcon('dropNotAllowed', this.gridOptionsService, null);\n }\n addDragSource(dragSource, allowTouch = false) {\n const params = {\n eElement: dragSource.eElement,\n dragStartPixels: dragSource.dragStartPixels,\n onDragStart: this.onDragStart.bind(this, dragSource),\n onDragStop: this.onDragStop.bind(this),\n onDragging: this.onDragging.bind(this),\n includeTouch: allowTouch\n };\n this.dragSourceAndParamsList.push({ params: params, dragSource: dragSource });\n this.dragService.addDragSource(params);\n }\n removeDragSource(dragSource) {\n const sourceAndParams = this.dragSourceAndParamsList.find(item => item.dragSource === dragSource);\n if (sourceAndParams) {\n this.dragService.removeDragSource(sourceAndParams.params);\n removeFromArray(this.dragSourceAndParamsList, sourceAndParams);\n }\n }\n clearDragSourceParamsList() {\n this.dragSourceAndParamsList.forEach(sourceAndParams => this.dragService.removeDragSource(sourceAndParams.params));\n this.dragSourceAndParamsList.length = 0;\n this.dropTargets.length = 0;\n }\n nudge() {\n if (this.dragging) {\n this.onDragging(this.eventLastTime, true);\n }\n }\n onDragStart(dragSource, mouseEvent) {\n this.dragging = true;\n this.dragSource = dragSource;\n this.eventLastTime = mouseEvent;\n this.dragItem = this.dragSource.getDragItem();\n this.lastDropTarget = this.dragSource.dragSourceDropTarget;\n if (this.dragSource.onDragStarted) {\n this.dragSource.onDragStarted();\n }\n this.createGhost();\n }\n onDragStop(mouseEvent) {\n this.eventLastTime = null;\n this.dragging = false;\n if (this.dragSource.onDragStopped) {\n this.dragSource.onDragStopped();\n }\n if (this.lastDropTarget && this.lastDropTarget.onDragStop) {\n const draggingEvent = this.createDropTargetEvent(this.lastDropTarget, mouseEvent, null, null, false);\n this.lastDropTarget.onDragStop(draggingEvent);\n }\n this.lastDropTarget = null;\n this.dragItem = null;\n this.removeGhost();\n }\n onDragging(mouseEvent, fromNudge) {\n var _a, _b, _c, _d;\n const hDirection = this.getHorizontalDirection(mouseEvent);\n const vDirection = this.getVerticalDirection(mouseEvent);\n this.eventLastTime = mouseEvent;\n this.positionGhost(mouseEvent);\n // check if mouseEvent intersects with any of the drop targets\n const validDropTargets = this.dropTargets.filter(target => this.isMouseOnDropTarget(mouseEvent, target));\n const dropTarget = this.findCurrentDropTarget(mouseEvent, validDropTargets);\n if (dropTarget !== this.lastDropTarget) {\n this.leaveLastTargetIfExists(mouseEvent, hDirection, vDirection, fromNudge);\n if (this.lastDropTarget !== null && dropTarget === null) {\n (_b = (_a = this.dragSource).onGridExit) === null || _b === void 0 ? void 0 : _b.call(_a, this.dragItem);\n }\n if (this.lastDropTarget === null && dropTarget !== null) {\n (_d = (_c = this.dragSource).onGridEnter) === null || _d === void 0 ? void 0 : _d.call(_c, this.dragItem);\n }\n this.enterDragTargetIfExists(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);\n this.lastDropTarget = dropTarget;\n }\n else if (dropTarget && dropTarget.onDragging) {\n const draggingEvent = this.createDropTargetEvent(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);\n dropTarget.onDragging(draggingEvent);\n }\n }\n getAllContainersFromDropTarget(dropTarget) {\n const secondaryContainers = dropTarget.getSecondaryContainers ? dropTarget.getSecondaryContainers() : null;\n const containers = [[dropTarget.getContainer()]];\n return secondaryContainers ? containers.concat(secondaryContainers) : containers;\n }\n allContainersIntersect(mouseEvent, containers) {\n for (const container of containers) {\n const rect = container.getBoundingClientRect();\n // if element is not visible, then width and height are zero\n if (rect.width === 0 || rect.height === 0) {\n return false;\n }\n const horizontalFit = mouseEvent.clientX >= rect.left && mouseEvent.clientX < rect.right;\n const verticalFit = mouseEvent.clientY >= rect.top && mouseEvent.clientY < rect.bottom;\n if (!horizontalFit || !verticalFit) {\n return false;\n }\n }\n return true;\n }\n // checks if the mouse is on the drop target. it checks eContainer and eSecondaryContainers\n isMouseOnDropTarget(mouseEvent, dropTarget) {\n const allContainersFromDropTarget = this.getAllContainersFromDropTarget(dropTarget);\n let mouseOverTarget = false;\n for (const currentContainers of allContainersFromDropTarget) {\n if (this.allContainersIntersect(mouseEvent, currentContainers)) {\n mouseOverTarget = true;\n break;\n }\n }\n if (dropTarget.targetContainsSource && !dropTarget.getContainer().contains(this.dragSource.eElement)) {\n return false;\n }\n return mouseOverTarget && dropTarget.isInterestedIn(this.dragSource.type, this.dragSource.eElement);\n }\n findCurrentDropTarget(mouseEvent, validDropTargets) {\n const len = validDropTargets.length;\n if (len === 0) {\n return null;\n }\n if (len === 1) {\n return validDropTargets[0];\n }\n const rootNode = this.gridOptionsService.getRootNode();\n // elementsFromPoint return a list of elements under\n // the mouseEvent sorted from topMost to bottomMost\n const elementStack = rootNode.elementsFromPoint(mouseEvent.clientX, mouseEvent.clientY);\n // loop over the sorted elementStack to find which dropTarget comes first\n for (const el of elementStack) {\n for (const dropTarget of validDropTargets) {\n const containers = flatten(this.getAllContainersFromDropTarget(dropTarget));\n if (containers.indexOf(el) !== -1) {\n return dropTarget;\n }\n }\n }\n // we should never hit this point of the code because only\n // valid dropTargets should be provided to this method.\n return null;\n }\n enterDragTargetIfExists(dropTarget, mouseEvent, hDirection, vDirection, fromNudge) {\n if (!dropTarget) {\n return;\n }\n if (dropTarget.onDragEnter) {\n const dragEnterEvent = this.createDropTargetEvent(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);\n dropTarget.onDragEnter(dragEnterEvent);\n }\n this.setGhostIcon(dropTarget.getIconName ? dropTarget.getIconName() : null);\n }\n leaveLastTargetIfExists(mouseEvent, hDirection, vDirection, fromNudge) {\n if (!this.lastDropTarget) {\n return;\n }\n if (this.lastDropTarget.onDragLeave) {\n const dragLeaveEvent = this.createDropTargetEvent(this.lastDropTarget, mouseEvent, hDirection, vDirection, fromNudge);\n this.lastDropTarget.onDragLeave(dragLeaveEvent);\n }\n this.setGhostIcon(null);\n }\n addDropTarget(dropTarget) {\n this.dropTargets.push(dropTarget);\n }\n removeDropTarget(dropTarget) {\n this.dropTargets = this.dropTargets.filter(target => target.getContainer() !== dropTarget.getContainer());\n }\n hasExternalDropZones() {\n return this.dropTargets.some(zones => zones.external);\n }\n findExternalZone(params) {\n const externalTargets = this.dropTargets.filter(target => target.external);\n return externalTargets.find(zone => zone.getContainer() === params.getContainer()) || null;\n }\n getHorizontalDirection(event) {\n const clientX = this.eventLastTime && this.eventLastTime.clientX;\n const eClientX = event.clientX;\n if (clientX === eClientX) {\n return null;\n }\n return clientX > eClientX ? HorizontalDirection.Left : HorizontalDirection.Right;\n }\n getVerticalDirection(event) {\n const clientY = this.eventLastTime && this.eventLastTime.clientY;\n const eClientY = event.clientY;\n if (clientY === eClientY) {\n return null;\n }\n return clientY > eClientY ? VerticalDirection.Up : VerticalDirection.Down;\n }\n createDropTargetEvent(dropTarget, event, hDirection, vDirection, fromNudge) {\n // localise x and y to the target\n const dropZoneTarget = dropTarget.getContainer();\n const rect = dropZoneTarget.getBoundingClientRect();\n const { gridApi: api, columnApi, dragItem, dragSource } = this;\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n return { event, x, y, vDirection, hDirection, dragSource, fromNudge, dragItem: dragItem, api, columnApi, dropZoneTarget };\n }\n positionGhost(event) {\n const ghost = this.eGhost;\n if (!ghost) {\n return;\n }\n const ghostRect = ghost.getBoundingClientRect();\n const ghostHeight = ghostRect.height;\n const browserWidth = getBodyWidth() - 2; // 2px for 1px borderLeft and 1px borderRight\n const browserHeight = getBodyHeight() - 2; // 2px for 1px borderTop and 1px borderBottom\n const offsetParentSize = getElementRectWithOffset(ghost.offsetParent);\n const { clientY, clientX } = event;\n let top = (clientY - offsetParentSize.top) - (ghostHeight / 2);\n let left = (clientX - offsetParentSize.left) - 10;\n const eDocument = this.gridOptionsService.getDocument();\n const win = (eDocument.defaultView || window);\n const windowScrollY = win.pageYOffset || eDocument.documentElement.scrollTop;\n const windowScrollX = win.pageXOffset || eDocument.documentElement.scrollLeft;\n // check ghost is not positioned outside of the browser\n if (browserWidth > 0 && ((left + ghost.clientWidth) > (browserWidth + windowScrollX))) {\n left = browserWidth + windowScrollX - ghost.clientWidth;\n }\n if (left < 0) {\n left = 0;\n }\n if (browserHeight > 0 && ((top + ghost.clientHeight) > (browserHeight + windowScrollY))) {\n top = browserHeight + windowScrollY - ghost.clientHeight;\n }\n if (top < 0) {\n top = 0;\n }\n ghost.style.left = `${left}px`;\n ghost.style.top = `${top}px`;\n }\n removeGhost() {\n if (this.eGhost && this.eGhostParent) {\n this.eGhostParent.removeChild(this.eGhost);\n }\n this.eGhost = null;\n }\n createGhost() {\n this.eGhost = loadTemplate(DragAndDropService_1.GHOST_TEMPLATE);\n this.mouseEventService.stampTopLevelGridCompWithGridInstance(this.eGhost);\n const { theme } = this.environment.getTheme();\n if (theme) {\n this.eGhost.classList.add(theme);\n }\n this.eGhostIcon = this.eGhost.querySelector('.ag-dnd-ghost-icon');\n this.setGhostIcon(null);\n const eText = this.eGhost.querySelector('.ag-dnd-ghost-label');\n let dragItemName = this.dragSource.dragItemName;\n if (isFunction(dragItemName)) {\n dragItemName = dragItemName();\n }\n eText.innerHTML = escapeString(dragItemName) || '';\n this.eGhost.style.height = '25px';\n this.eGhost.style.top = '20px';\n this.eGhost.style.left = '20px';\n const eDocument = this.gridOptionsService.getDocument();\n let targetEl = null;\n try {\n targetEl = eDocument.fullscreenElement;\n }\n catch (e) {\n // some environments like SalesForce will throw errors\n // simply by trying to read the fullscreenElement property\n }\n finally {\n if (!targetEl) {\n const rootNode = this.gridOptionsService.getRootNode();\n const body = rootNode.querySelector('body');\n if (body) {\n targetEl = body;\n }\n else if (rootNode instanceof ShadowRoot) {\n targetEl = rootNode;\n }\n else {\n targetEl = rootNode === null || rootNode === void 0 ? void 0 : rootNode.documentElement;\n }\n }\n }\n this.eGhostParent = targetEl;\n if (!this.eGhostParent) {\n console.warn('AG Grid: could not find document body, it is needed for dragging columns');\n }\n else {\n this.eGhostParent.appendChild(this.eGhost);\n }\n }\n setGhostIcon(iconName, shake = false) {\n clearElement(this.eGhostIcon);\n let eIcon = null;\n if (!iconName) {\n iconName = this.dragSource.defaultIconName || DragAndDropService_1.ICON_NOT_ALLOWED;\n }\n switch (iconName) {\n case DragAndDropService_1.ICON_PINNED:\n eIcon = this.ePinnedIcon;\n break;\n case DragAndDropService_1.ICON_MOVE:\n eIcon = this.eMoveIcon;\n break;\n case DragAndDropService_1.ICON_LEFT:\n eIcon = this.eLeftIcon;\n break;\n case DragAndDropService_1.ICON_RIGHT:\n eIcon = this.eRightIcon;\n break;\n case DragAndDropService_1.ICON_GROUP:\n eIcon = this.eGroupIcon;\n break;\n case DragAndDropService_1.ICON_AGGREGATE:\n eIcon = this.eAggregateIcon;\n break;\n case DragAndDropService_1.ICON_PIVOT:\n eIcon = this.ePivotIcon;\n break;\n case DragAndDropService_1.ICON_NOT_ALLOWED:\n eIcon = this.eDropNotAllowedIcon;\n break;\n case DragAndDropService_1.ICON_HIDE:\n eIcon = this.eHideIcon;\n break;\n }\n this.eGhostIcon.classList.toggle('ag-shake-left-to-right', shake);\n if (eIcon === this.eHideIcon && this.gridOptionsService.is('suppressDragLeaveHidesColumns')) {\n return;\n }\n if (eIcon) {\n this.eGhostIcon.appendChild(eIcon);\n }\n }\n};\nDragAndDropService.ICON_PINNED = 'pinned';\nDragAndDropService.ICON_MOVE = 'move';\nDragAndDropService.ICON_LEFT = 'left';\nDragAndDropService.ICON_RIGHT = 'right';\nDragAndDropService.ICON_GROUP = 'group';\nDragAndDropService.ICON_AGGREGATE = 'aggregate';\nDragAndDropService.ICON_PIVOT = 'pivot';\nDragAndDropService.ICON_NOT_ALLOWED = 'notAllowed';\nDragAndDropService.ICON_HIDE = 'hide';\nDragAndDropService.GHOST_TEMPLATE = `
\n \n
\n
`;\n__decorate([\n Autowired('dragService')\n], DragAndDropService.prototype, \"dragService\", void 0);\n__decorate([\n Autowired('mouseEventService')\n], DragAndDropService.prototype, \"mouseEventService\", void 0);\n__decorate([\n Autowired('columnApi')\n], DragAndDropService.prototype, \"columnApi\", void 0);\n__decorate([\n Autowired('gridApi')\n], DragAndDropService.prototype, \"gridApi\", void 0);\n__decorate([\n PostConstruct\n], DragAndDropService.prototype, \"init\", null);\n__decorate([\n PreDestroy\n], DragAndDropService.prototype, \"clearDragSourceParamsList\", null);\nDragAndDropService = DragAndDropService_1 = __decorate([\n Bean('dragAndDropService')\n], DragAndDropService);\nexport { DragAndDropService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from \"../../widgets/component.mjs\";\nimport { Autowired, PostConstruct, PreDestroy } from \"../../context/context.mjs\";\nimport { RowNode } from \"../../entities/rowNode.mjs\";\nimport { DragSourceType } from \"../../dragAndDrop/dragAndDropService.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { createIconNoSpan } from \"../../utils/icon.mjs\";\nimport { doOnce, isFunction } from \"../../utils/function.mjs\";\nexport class RowDragComp extends Component {\n constructor(cellValueFn, rowNode, column, customGui, dragStartPixels, suppressVisibilityChange) {\n super();\n this.cellValueFn = cellValueFn;\n this.rowNode = rowNode;\n this.column = column;\n this.customGui = customGui;\n this.dragStartPixels = dragStartPixels;\n this.suppressVisibilityChange = suppressVisibilityChange;\n this.dragSource = null;\n }\n isCustomGui() {\n return this.customGui != null;\n }\n postConstruct() {\n if (!this.customGui) {\n this.setTemplate(/* html */ `
`);\n this.getGui().appendChild(createIconNoSpan('rowDrag', this.gridOptionsService, null));\n this.addDragSource();\n }\n else {\n this.setDragElement(this.customGui, this.dragStartPixels);\n }\n this.checkCompatibility();\n if (!this.suppressVisibilityChange) {\n const strategy = this.gridOptionsService.is('rowDragManaged') ?\n new ManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column) :\n new NonManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column);\n this.createManagedBean(strategy, this.beans.context);\n }\n }\n setDragElement(dragElement, dragStartPixels) {\n this.setTemplateFromElement(dragElement);\n this.addDragSource(dragStartPixels);\n }\n getSelectedNodes() {\n const isRowDragMultiRow = this.gridOptionsService.is('rowDragMultiRow');\n if (!isRowDragMultiRow) {\n return [this.rowNode];\n }\n const selection = this.beans.selectionService.getSelectedNodes();\n return selection.indexOf(this.rowNode) !== -1 ? selection : [this.rowNode];\n }\n // returns true if all compatibility items work out\n checkCompatibility() {\n const managed = this.gridOptionsService.is('rowDragManaged');\n const treeData = this.gridOptionsService.isTreeData();\n if (treeData && managed) {\n doOnce(() => console.warn('AG Grid: If using row drag with tree data, you cannot have rowDragManaged=true'), 'RowDragComp.managedAndTreeData');\n }\n }\n getDragItem() {\n return {\n rowNode: this.rowNode,\n rowNodes: this.getSelectedNodes(),\n columns: this.column ? [this.column] : undefined,\n defaultTextValue: this.cellValueFn(),\n };\n }\n getRowDragText(column) {\n if (column) {\n const colDef = column.getColDef();\n if (colDef.rowDragText) {\n return colDef.rowDragText;\n }\n }\n return this.gridOptionsService.get('rowDragText');\n }\n addDragSource(dragStartPixels = 4) {\n // if this is changing the drag element, delete the previous dragSource\n if (this.dragSource) {\n this.removeDragSource();\n }\n const rowDragText = this.getRowDragText(this.column);\n const translate = this.localeService.getLocaleTextFunc();\n this.dragSource = {\n type: DragSourceType.RowDrag,\n eElement: this.getGui(),\n dragItemName: () => {\n var _a;\n const dragItem = this.getDragItem();\n const dragItemCount = ((_a = dragItem.rowNodes) === null || _a === void 0 ? void 0 : _a.length) || 1;\n if (rowDragText) {\n return rowDragText(dragItem, dragItemCount);\n }\n return dragItemCount === 1 ? this.cellValueFn() : `${dragItemCount} ${translate('rowDragRows', 'rows')}`;\n },\n getDragItem: () => this.getDragItem(),\n dragStartPixels,\n dragSourceDomDataKey: this.gridOptionsService.getDomDataKey()\n };\n this.beans.dragAndDropService.addDragSource(this.dragSource, true);\n }\n removeDragSource() {\n if (this.dragSource) {\n this.beans.dragAndDropService.removeDragSource(this.dragSource);\n }\n this.dragSource = null;\n }\n}\n__decorate([\n Autowired('beans')\n], RowDragComp.prototype, \"beans\", void 0);\n__decorate([\n PostConstruct\n], RowDragComp.prototype, \"postConstruct\", null);\n__decorate([\n PreDestroy\n], RowDragComp.prototype, \"removeDragSource\", null);\nclass VisibilityStrategy extends BeanStub {\n constructor(parent, rowNode, column) {\n super();\n this.parent = parent;\n this.rowNode = rowNode;\n this.column = column;\n }\n setDisplayedOrVisible(neverDisplayed) {\n const displayedOptions = { skipAriaHidden: true };\n if (neverDisplayed) {\n this.parent.setDisplayed(false, displayedOptions);\n }\n else {\n let shown = true;\n let isShownSometimes = false;\n if (this.column) {\n shown = this.column.isRowDrag(this.rowNode) || this.parent.isCustomGui();\n isShownSometimes = isFunction(this.column.getColDef().rowDrag);\n }\n // if shown sometimes, them some rows can have drag handle while other don't,\n // so we use setVisible to keep the handles horizontally aligned (as setVisible\n // keeps the empty space, whereas setDisplayed looses the space)\n if (isShownSometimes) {\n this.parent.setDisplayed(true, displayedOptions);\n this.parent.setVisible(shown, displayedOptions);\n }\n else {\n this.parent.setDisplayed(shown, displayedOptions);\n this.parent.setVisible(true, displayedOptions);\n }\n }\n }\n}\n// when non managed, the visibility depends on suppressRowDrag property only\nclass NonManagedVisibilityStrategy extends VisibilityStrategy {\n constructor(parent, beans, rowNode, column) {\n super(parent, rowNode, column);\n this.beans = beans;\n }\n postConstruct() {\n this.addManagedPropertyListener('suppressRowDrag', this.onSuppressRowDrag.bind(this));\n // in case data changes, then we need to update visibility of drag item\n this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));\n this.addManagedListener(this.beans.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.workOutVisibility.bind(this));\n this.workOutVisibility();\n }\n onSuppressRowDrag() {\n this.workOutVisibility();\n }\n workOutVisibility() {\n // only show the drag if both sort and filter are not present\n const neverDisplayed = this.gridOptionsService.is('suppressRowDrag');\n this.setDisplayedOrVisible(neverDisplayed);\n }\n}\n__decorate([\n PostConstruct\n], NonManagedVisibilityStrategy.prototype, \"postConstruct\", null);\n// when managed, the visibility depends on sort, filter and row group, as well as suppressRowDrag property\nclass ManagedVisibilityStrategy extends VisibilityStrategy {\n constructor(parent, beans, rowNode, column) {\n super(parent, rowNode, column);\n this.beans = beans;\n }\n postConstruct() {\n // we do not show the component if sort, filter or grouping is active\n this.addManagedListener(this.beans.eventService, Events.EVENT_SORT_CHANGED, this.workOutVisibility.bind(this));\n this.addManagedListener(this.beans.eventService, Events.EVENT_FILTER_CHANGED, this.workOutVisibility.bind(this));\n this.addManagedListener(this.beans.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.workOutVisibility.bind(this));\n this.addManagedListener(this.beans.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.workOutVisibility.bind(this));\n // in case data changes, then we need to update visibility of drag item\n this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));\n this.addManagedPropertyListener('suppressRowDrag', this.onSuppressRowDrag.bind(this));\n this.workOutVisibility();\n }\n onSuppressRowDrag() {\n this.workOutVisibility();\n }\n workOutVisibility() {\n // only show the drag if both sort and filter are not present\n const gridBodyCon = this.beans.ctrlsService.getGridBodyCtrl();\n const rowDragFeature = gridBodyCon.getRowDragFeature();\n const shouldPreventRowMove = rowDragFeature && rowDragFeature.shouldPreventRowMove();\n const suppressRowDrag = this.gridOptionsService.is('suppressRowDrag');\n const hasExternalDropZones = this.beans.dragAndDropService.hasExternalDropZones();\n const neverDisplayed = (shouldPreventRowMove && !hasExternalDropZones) || suppressRowDrag;\n this.setDisplayedOrVisible(neverDisplayed);\n }\n}\n__decorate([\n PostConstruct\n], ManagedVisibilityStrategy.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { KeyCode } from \"../../constants/keyCode.mjs\";\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired } from \"../../context/context.mjs\";\nimport { RowNode } from \"../../entities/rowNode.mjs\";\nimport { removeAriaExpanded, setAriaExpanded } from \"../../utils/aria.mjs\";\nimport { isElementInEventPath, isStopPropagationForAgGrid, stopPropagationForAgGrid } from \"../../utils/event.mjs\";\nimport { missing } from \"../../utils/generic.mjs\";\nimport { createIconNoSpan } from \"../../utils/icon.mjs\";\nimport { cloneObject } from \"../../utils/object.mjs\";\nimport { CheckboxSelectionComponent } from \"../checkboxSelectionComponent.mjs\";\nimport { RowDragComp } from \"../row/rowDragComp.mjs\";\nexport class GroupCellRendererCtrl extends BeanStub {\n init(comp, eGui, eCheckbox, eExpanded, eContracted, compClass, params) {\n this.params = params;\n this.eGui = eGui;\n this.eCheckbox = eCheckbox;\n this.eExpanded = eExpanded;\n this.eContracted = eContracted;\n this.comp = comp;\n this.compClass = compClass;\n const topLevelFooter = this.isTopLevelFooter();\n const embeddedRowMismatch = this.isEmbeddedRowMismatch();\n // This allows for empty strings to appear as groups since\n // it will only return for null or undefined.\n const isNullValueAndNotMaster = params.value == null && !params.node.master;\n let skipCell = false;\n // if the groupCellRenderer is inside of a footer and groupHideOpenParents is true\n // we should only display the groupCellRenderer if the current column is the rowGroupedColumn\n if (this.gridOptionsService.is('groupIncludeFooter') && this.gridOptionsService.is('groupHideOpenParents')) {\n const node = params.node;\n if (node.footer) {\n const showRowGroup = params.colDef && params.colDef.showRowGroup;\n const rowGroupColumnId = node.rowGroupColumn && node.rowGroupColumn.getColId();\n skipCell = showRowGroup !== rowGroupColumnId;\n }\n }\n this.cellIsBlank = topLevelFooter ? false : (embeddedRowMismatch || (isNullValueAndNotMaster && !params.node.master) || skipCell);\n if (this.cellIsBlank) {\n return;\n }\n this.setupShowingValueForOpenedParent();\n this.findDisplayedGroupNode();\n this.addFullWidthRowDraggerIfNeeded();\n this.addExpandAndContract();\n this.addCheckboxIfNeeded();\n this.addValueElement();\n this.setupIndent();\n this.refreshAriaExpanded();\n }\n destroy() {\n super.destroy();\n // property cleanup to avoid memory leaks\n this.expandListener = null;\n }\n refreshAriaExpanded() {\n const { node, eParentOfValue } = this.params;\n if (this.expandListener) {\n this.expandListener = this.expandListener();\n }\n if (!this.isExpandable()) {\n removeAriaExpanded(eParentOfValue);\n return;\n }\n const listener = () => {\n // for react, we don't use JSX, as setting attributes via jsx is slower\n setAriaExpanded(eParentOfValue, !!node.expanded);\n };\n this.expandListener = this.addManagedListener(node, RowNode.EVENT_EXPANDED_CHANGED, listener) || null;\n listener();\n }\n isTopLevelFooter() {\n if (!this.gridOptionsService.is('groupIncludeTotalFooter')) {\n return false;\n }\n if (this.params.value != null || this.params.node.level != -1) {\n return false;\n }\n // at this point, we know it's the root node and there is no value present, so it's a footer cell.\n // the only thing to work out is if we are displaying groups across multiple\n // columns (groupDisplayType: 'multipleColumns'), we only want 'total' to appear in the first column.\n const colDef = this.params.colDef;\n const doingFullWidth = colDef == null;\n if (doingFullWidth) {\n return true;\n }\n if (colDef.showRowGroup === true) {\n return true;\n }\n const rowGroupCols = this.columnModel.getRowGroupColumns();\n // this is a sanity check, rowGroupCols should always be present\n if (!rowGroupCols || rowGroupCols.length === 0) {\n return true;\n }\n const firstRowGroupCol = rowGroupCols[0];\n return firstRowGroupCol.getId() === colDef.showRowGroup;\n }\n // if we are doing embedded full width rows, we only show the renderer when\n // in the body, or if pinning in the pinned section, or if pinning and RTL,\n // in the right section. otherwise we would have the cell repeated in each section.\n isEmbeddedRowMismatch() {\n if (!this.params.fullWidth || !this.gridOptionsService.is('embedFullWidthRows')) {\n return false;\n }\n const pinnedLeftCell = this.params.pinned === 'left';\n const pinnedRightCell = this.params.pinned === 'right';\n const bodyCell = !pinnedLeftCell && !pinnedRightCell;\n if (this.gridOptionsService.is('enableRtl')) {\n if (this.columnModel.isPinningLeft()) {\n return !pinnedRightCell;\n }\n return !bodyCell;\n }\n if (this.columnModel.isPinningLeft()) {\n return !pinnedLeftCell;\n }\n return !bodyCell;\n }\n findDisplayedGroupNode() {\n const column = this.params.column;\n const rowNode = this.params.node;\n if (this.showingValueForOpenedParent) {\n let pointer = rowNode.parent;\n while (pointer != null) {\n if (pointer.rowGroupColumn && column.isRowGroupDisplayed(pointer.rowGroupColumn.getId())) {\n this.displayedGroupNode = pointer;\n break;\n }\n pointer = pointer.parent;\n }\n }\n // if we didn't find a displayed group, set it to the row node\n if (missing(this.displayedGroupNode)) {\n this.displayedGroupNode = rowNode;\n }\n }\n setupShowingValueForOpenedParent() {\n // note - this code depends on sortService.updateGroupDataForHiddenOpenParents, where group data\n // is updated to reflect the dragged down parents\n const rowNode = this.params.node;\n const column = this.params.column;\n if (!this.gridOptionsService.is('groupHideOpenParents')) {\n this.showingValueForOpenedParent = false;\n return;\n }\n // hideOpenParents means rowNode.groupData can have data for the group this column is displaying, even though\n // this rowNode isn't grouping by the column we are displaying\n // if no groupData at all, we are not showing a parent value\n if (!rowNode.groupData) {\n this.showingValueForOpenedParent = false;\n return;\n }\n // this is the normal case, in that we are showing a group for which this column is configured. note that\n // this means the Row Group is closed (if it was open, we would not be displaying it)\n const showingGroupNode = rowNode.rowGroupColumn != null;\n if (showingGroupNode) {\n const keyOfGroupingColumn = rowNode.rowGroupColumn.getId();\n const configuredToShowThisGroupLevel = column.isRowGroupDisplayed(keyOfGroupingColumn);\n // if showing group as normal, we didn't take group info from parent\n if (configuredToShowThisGroupLevel) {\n this.showingValueForOpenedParent = false;\n return;\n }\n }\n // see if we are showing a Group Value for the Displayed Group. if we are showing a group value, and this Row Node\n // is not grouping by this Displayed Group, we must of gotten the value from a parent node\n const valPresent = rowNode.groupData[column.getId()] != null;\n this.showingValueForOpenedParent = valPresent;\n }\n addValueElement() {\n if (this.displayedGroupNode.footer) {\n this.addFooterValue();\n }\n else {\n this.addGroupValue();\n this.addChildCount();\n }\n }\n addGroupValue() {\n // we try and use the cellRenderer of the column used for the grouping if we can\n const paramsAdjusted = this.adjustParamsWithDetailsFromRelatedColumn();\n const innerCompDetails = this.getInnerCompDetails(paramsAdjusted);\n const { valueFormatted, value } = paramsAdjusted;\n let valueWhenNoRenderer = valueFormatted;\n if (valueWhenNoRenderer == null) {\n if (value === '' && this.params.node.group) {\n const localeTextFunc = this.localeService.getLocaleTextFunc();\n valueWhenNoRenderer = localeTextFunc('blanks', '(Blanks)');\n }\n else {\n valueWhenNoRenderer = value !== null && value !== void 0 ? value : null;\n }\n }\n this.comp.setInnerRenderer(innerCompDetails, valueWhenNoRenderer);\n }\n adjustParamsWithDetailsFromRelatedColumn() {\n const relatedColumn = this.displayedGroupNode.rowGroupColumn;\n const column = this.params.column;\n if (!relatedColumn) {\n return this.params;\n }\n const notFullWidth = column != null;\n if (notFullWidth) {\n const showingThisRowGroup = column.isRowGroupDisplayed(relatedColumn.getId());\n if (!showingThisRowGroup) {\n return this.params;\n }\n }\n const params = this.params;\n const { value, node } = this.params;\n const valueFormatted = this.valueFormatterService.formatValue(relatedColumn, node, value);\n // we don't update the original params, as they could of come through React,\n // as react has RowGroupCellRenderer, which means the params could be props which\n // would be read only\n const paramsAdjusted = Object.assign(Object.assign({}, params), { valueFormatted: valueFormatted });\n return paramsAdjusted;\n }\n addFooterValue() {\n const footerValueGetter = this.params.footerValueGetter;\n let footerValue = '';\n if (footerValueGetter) {\n // params is same as we were given, except we set the value as the item to display\n const paramsClone = cloneObject(this.params);\n paramsClone.value = this.params.value;\n if (typeof footerValueGetter === 'function') {\n footerValue = footerValueGetter(paramsClone);\n }\n else if (typeof footerValueGetter === 'string') {\n footerValue = this.expressionService.evaluate(footerValueGetter, paramsClone);\n }\n else {\n console.warn('AG Grid: footerValueGetter should be either a function or a string (expression)');\n }\n }\n else {\n footerValue = 'Total ' + (this.params.value != null ? this.params.value : '');\n }\n const innerCompDetails = this.getInnerCompDetails(this.params);\n this.comp.setInnerRenderer(innerCompDetails, footerValue);\n }\n getInnerCompDetails(params) {\n // for full width rows, we don't do any of the below\n if (params.fullWidth) {\n return this.userComponentFactory.getFullWidthGroupRowInnerCellRenderer(this.gridOptionsService.get('groupRowRendererParams'), params);\n }\n // when grouping, the normal case is we use the cell renderer of the grouped column. eg if grouping by country\n // and then rating, we will use the country cell renderer for each country group row and likewise the rating\n // cell renderer for each rating group row.\n //\n // however if the user has innerCellRenderer defined, this gets preference and we don't use cell renderers\n // of the grouped columns.\n //\n // so we check and use in the following order:\n //\n // 1) thisColDef.cellRendererParams.innerRenderer of the column showing the groups (eg auto group column)\n // 2) groupedColDef.cellRenderer of the grouped column\n // 3) groupedColDef.cellRendererParams.innerRenderer\n // we check if cell renderer provided for the group cell renderer, eg colDef.cellRendererParams.innerRenderer\n const innerCompDetails = this.userComponentFactory\n .getInnerRendererDetails(params, params);\n // avoid using GroupCellRenderer again, otherwise stack overflow, as we insert same renderer again and again.\n // this covers off chance user is grouping by a column that is also configured with GroupCellRenderer\n const isGroupRowRenderer = (details) => details && details.componentClass == this.compClass;\n if (innerCompDetails && !isGroupRowRenderer(innerCompDetails)) {\n // use the renderer defined in cellRendererParams.innerRenderer\n return innerCompDetails;\n }\n const relatedColumn = this.displayedGroupNode.rowGroupColumn;\n const relatedColDef = relatedColumn ? relatedColumn.getColDef() : undefined;\n if (!relatedColDef) {\n return;\n }\n // otherwise see if we can use the cellRenderer of the column we are grouping by\n const relatedCompDetails = this.userComponentFactory\n .getCellRendererDetails(relatedColDef, params);\n if (relatedCompDetails && !isGroupRowRenderer(relatedCompDetails)) {\n // Only if the original column is using a specific renderer, it it is a using a DEFAULT one ignore it\n return relatedCompDetails;\n }\n if (isGroupRowRenderer(relatedCompDetails) &&\n relatedColDef.cellRendererParams &&\n relatedColDef.cellRendererParams.innerRenderer) {\n // edge case - this comes from a column which has been grouped dynamically, that has a renderer 'group'\n // and has an inner cell renderer\n const res = this.userComponentFactory.getInnerRendererDetails(relatedColDef.cellRendererParams, params);\n return res;\n }\n }\n addChildCount() {\n // only include the child count if it's included, eg if user doing custom aggregation,\n // then this could be left out, or set to -1, ie no child count\n if (this.params.suppressCount) {\n return;\n }\n this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED, this.updateChildCount.bind(this));\n // filtering changes the child count, so need to cater for it\n this.updateChildCount();\n }\n updateChildCount() {\n const allChildrenCount = this.displayedGroupNode.allChildrenCount;\n const showingGroupForThisNode = this.isShowRowGroupForThisRow();\n const showCount = showingGroupForThisNode && allChildrenCount != null && allChildrenCount >= 0;\n const countString = showCount ? `(${allChildrenCount})` : ``;\n this.comp.setChildCount(countString);\n }\n isShowRowGroupForThisRow() {\n if (this.gridOptionsService.isTreeData()) {\n return true;\n }\n const rowGroupColumn = this.displayedGroupNode.rowGroupColumn;\n if (!rowGroupColumn) {\n return false;\n }\n // column is null for fullWidthRows\n const column = this.params.column;\n const thisColumnIsInterested = column == null || column.isRowGroupDisplayed(rowGroupColumn.getId());\n return thisColumnIsInterested;\n }\n addExpandAndContract() {\n var _a;\n const params = this.params;\n const eExpandedIcon = createIconNoSpan('groupExpanded', this.gridOptionsService, null);\n const eContractedIcon = createIconNoSpan('groupContracted', this.gridOptionsService, null);\n if (eExpandedIcon) {\n this.eExpanded.appendChild(eExpandedIcon);\n }\n if (eContractedIcon) {\n this.eContracted.appendChild(eContractedIcon);\n }\n const eGroupCell = params.eGridCell;\n // if editing groups, then double click is to start editing\n const isDoubleClickEdit = ((_a = this.params.column) === null || _a === void 0 ? void 0 : _a.isCellEditable(params.node)) && this.gridOptionsService.is('enableGroupEdit');\n if (!isDoubleClickEdit && this.isExpandable() && !params.suppressDoubleClickExpand) {\n this.addManagedListener(eGroupCell, 'dblclick', this.onCellDblClicked.bind(this));\n }\n this.addManagedListener(this.eExpanded, 'click', this.onExpandClicked.bind(this));\n this.addManagedListener(this.eContracted, 'click', this.onExpandClicked.bind(this));\n // expand / contract as the user hits enter\n this.addManagedListener(eGroupCell, 'keydown', this.onKeyDown.bind(this));\n this.addManagedListener(params.node, RowNode.EVENT_EXPANDED_CHANGED, this.showExpandAndContractIcons.bind(this));\n this.showExpandAndContractIcons();\n // because we don't show the expand / contract when there are no children, we need to check every time\n // the number of children change.\n const expandableChangedListener = this.onRowNodeIsExpandableChanged.bind(this);\n this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED, expandableChangedListener);\n this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_MASTER_CHANGED, expandableChangedListener);\n this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_GROUP_CHANGED, expandableChangedListener);\n this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_HAS_CHILDREN_CHANGED, expandableChangedListener);\n }\n onExpandClicked(mouseEvent) {\n if (isStopPropagationForAgGrid(mouseEvent)) {\n return;\n }\n // so if we expand a node, it does not also get selected.\n stopPropagationForAgGrid(mouseEvent);\n this.onExpandOrContract(mouseEvent);\n }\n onExpandOrContract(e) {\n // must use the displayedGroup, so if data was dragged down, we expand the parent, not this row\n const rowNode = this.displayedGroupNode;\n const nextExpandState = !rowNode.expanded;\n if (!nextExpandState && rowNode.sticky) {\n this.scrollToStickyNode(rowNode);\n }\n rowNode.setExpanded(nextExpandState, e);\n }\n scrollToStickyNode(rowNode) {\n const gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();\n const scrollFeature = gridBodyCtrl.getScrollFeature();\n scrollFeature.setVerticalScrollPosition(rowNode.rowTop - rowNode.stickyRowTop);\n }\n isExpandable() {\n if (this.showingValueForOpenedParent) {\n return true;\n }\n const rowNode = this.displayedGroupNode;\n const reducedLeafNode = this.columnModel.isPivotMode() && rowNode.leafGroup;\n const expandableGroup = rowNode.isExpandable() && !rowNode.footer && !reducedLeafNode;\n if (!expandableGroup) {\n return false;\n }\n // column is null for fullWidthRows\n const column = this.params.column;\n const displayingForOneColumnOnly = column != null && typeof column.getColDef().showRowGroup === 'string';\n if (displayingForOneColumnOnly) {\n const showing = this.isShowRowGroupForThisRow();\n return showing;\n }\n return true;\n }\n showExpandAndContractIcons() {\n const { params, displayedGroupNode: displayedGroup, columnModel } = this;\n const { node } = params;\n const isExpandable = this.isExpandable();\n if (isExpandable) {\n // if expandable, show one based on expand state.\n // if we were dragged down, means our parent is always expanded\n const expanded = this.showingValueForOpenedParent ? true : node.expanded;\n this.comp.setExpandedDisplayed(expanded);\n this.comp.setContractedDisplayed(!expanded);\n }\n else {\n // it not expandable, show neither\n this.comp.setExpandedDisplayed(false);\n this.comp.setContractedDisplayed(false);\n }\n // compensation padding for leaf nodes, so there is blank space instead of the expand icon\n const pivotMode = columnModel.isPivotMode();\n const pivotModeAndLeafGroup = pivotMode && displayedGroup.leafGroup;\n const addExpandableCss = isExpandable && !pivotModeAndLeafGroup;\n const isTotalFooterNode = node.footer && node.level === -1;\n this.comp.addOrRemoveCssClass('ag-cell-expandable', addExpandableCss);\n this.comp.addOrRemoveCssClass('ag-row-group', addExpandableCss);\n if (pivotMode) {\n this.comp.addOrRemoveCssClass('ag-pivot-leaf-group', pivotModeAndLeafGroup);\n }\n else if (!isTotalFooterNode) {\n this.comp.addOrRemoveCssClass('ag-row-group-leaf-indent', !addExpandableCss);\n }\n }\n onRowNodeIsExpandableChanged() {\n // maybe if no children now, we should hide the expand / contract icons\n this.showExpandAndContractIcons();\n // if we have no children, this impacts the indent\n this.setIndent();\n this.refreshAriaExpanded();\n }\n setupIndent() {\n // only do this if an indent - as this overwrites the padding that\n // the theme set, which will make things look 'not aligned' for the\n // first group level.\n const node = this.params.node;\n const suppressPadding = this.params.suppressPadding;\n if (!suppressPadding) {\n this.addManagedListener(node, RowNode.EVENT_UI_LEVEL_CHANGED, this.setIndent.bind(this));\n this.setIndent();\n }\n }\n setIndent() {\n if (this.gridOptionsService.is('groupHideOpenParents')) {\n return;\n }\n const params = this.params;\n const rowNode = params.node;\n // if we are only showing one group column, we don't want to be indenting based on level\n const fullWithRow = !!params.colDef;\n const treeData = this.gridOptionsService.isTreeData();\n const manyDimensionThisColumn = !fullWithRow || treeData || params.colDef.showRowGroup === true;\n const paddingCount = manyDimensionThisColumn ? rowNode.uiLevel : 0;\n if (this.indentClass) {\n this.comp.addOrRemoveCssClass(this.indentClass, false);\n }\n this.indentClass = 'ag-row-group-indent-' + paddingCount;\n this.comp.addOrRemoveCssClass(this.indentClass, true);\n }\n addFullWidthRowDraggerIfNeeded() {\n if (!this.params.fullWidth || !this.params.rowDrag) {\n return;\n }\n const rowDragComp = new RowDragComp(() => this.params.value, this.params.node);\n this.createManagedBean(rowDragComp, this.context);\n this.eGui.insertAdjacentElement('afterbegin', rowDragComp.getGui());\n }\n isUserWantsSelected() {\n const paramsCheckbox = this.params.checkbox;\n // if a function, we always return true as change detection can show or hide the checkbox.\n return typeof paramsCheckbox === 'function' || paramsCheckbox === true;\n }\n addCheckboxIfNeeded() {\n const rowNode = this.displayedGroupNode;\n const checkboxNeeded = this.isUserWantsSelected() &&\n // footers cannot be selected\n !rowNode.footer &&\n // pinned rows cannot be selected\n !rowNode.rowPinned &&\n // details cannot be selected\n !rowNode.detail;\n if (checkboxNeeded) {\n const cbSelectionComponent = new CheckboxSelectionComponent();\n this.getContext().createBean(cbSelectionComponent);\n cbSelectionComponent.init({\n rowNode: rowNode,\n column: this.params.column,\n overrides: {\n isVisible: this.params.checkbox,\n callbackParams: this.params,\n removeHidden: true,\n },\n });\n this.eCheckbox.appendChild(cbSelectionComponent.getGui());\n this.addDestroyFunc(() => this.getContext().destroyBean(cbSelectionComponent));\n }\n this.comp.setCheckboxVisible(checkboxNeeded);\n }\n onKeyDown(event) {\n const isEnterKey = event.key === KeyCode.ENTER;\n if (!isEnterKey || this.params.suppressEnterExpand) {\n return;\n }\n const cellEditable = this.params.column && this.params.column.isCellEditable(this.params.node);\n if (cellEditable) {\n return;\n }\n this.onExpandOrContract(event);\n }\n onCellDblClicked(mouseEvent) {\n if (isStopPropagationForAgGrid(mouseEvent)) {\n return;\n }\n // we want to avoid acting on double click events on the expand / contract icon,\n // as that icons already has expand / collapse functionality on it. otherwise if\n // the icon was double clicked, we would get 'click', 'click', 'dblclick' which\n // is open->close->open, however double click should be open->close only.\n const targetIsExpandIcon = isElementInEventPath(this.eExpanded, mouseEvent)\n || isElementInEventPath(this.eContracted, mouseEvent);\n if (!targetIsExpandIcon) {\n this.onExpandOrContract(mouseEvent);\n }\n }\n}\n__decorate([\n Autowired('expressionService')\n], GroupCellRendererCtrl.prototype, \"expressionService\", void 0);\n__decorate([\n Autowired('valueFormatterService')\n], GroupCellRendererCtrl.prototype, \"valueFormatterService\", void 0);\n__decorate([\n Autowired('columnModel')\n], GroupCellRendererCtrl.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('userComponentFactory')\n], GroupCellRendererCtrl.prototype, \"userComponentFactory\", void 0);\n__decorate([\n Autowired(\"ctrlsService\")\n], GroupCellRendererCtrl.prototype, \"ctrlsService\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { setAriaRole } from \"../../utils/aria.mjs\";\nimport { setDisplayed } from \"../../utils/dom.mjs\";\nimport { Component } from \"../../widgets/component.mjs\";\nimport { RefSelector } from \"../../widgets/componentAnnotations.mjs\";\nimport { GroupCellRendererCtrl } from \"./groupCellRendererCtrl.mjs\";\nexport class GroupCellRenderer extends Component {\n constructor() {\n super(GroupCellRenderer.TEMPLATE);\n }\n init(params) {\n const compProxy = {\n setInnerRenderer: (compDetails, valueToDisplay) => this.setRenderDetails(compDetails, valueToDisplay),\n setChildCount: count => this.eChildCount.innerHTML = count,\n addOrRemoveCssClass: (cssClass, value) => this.addOrRemoveCssClass(cssClass, value),\n setContractedDisplayed: expanded => setDisplayed(this.eContracted, expanded),\n setExpandedDisplayed: expanded => setDisplayed(this.eExpanded, expanded),\n setCheckboxVisible: visible => this.eCheckbox.classList.toggle('ag-invisible', !visible)\n };\n const ctrl = this.createManagedBean(new GroupCellRendererCtrl());\n const fullWidth = !params.colDef;\n const eGui = this.getGui();\n ctrl.init(compProxy, eGui, this.eCheckbox, this.eExpanded, this.eContracted, this.constructor, params);\n if (fullWidth) {\n setAriaRole(eGui, 'gridcell');\n }\n }\n setRenderDetails(compDetails, valueToDisplay) {\n if (compDetails) {\n const componentPromise = compDetails.newAgStackInstance();\n if (!componentPromise) {\n return;\n }\n componentPromise.then(comp => {\n if (!comp) {\n return;\n }\n const destroyComp = () => this.context.destroyBean(comp);\n if (this.isAlive()) {\n this.eValue.appendChild(comp.getGui());\n this.addDestroyFunc(destroyComp);\n }\n else {\n destroyComp();\n }\n });\n }\n else {\n this.eValue.innerText = valueToDisplay;\n }\n }\n // this is a user component, and IComponent has \"public destroy()\" as part of the interface.\n // so we need to have public here instead of private or protected\n destroy() {\n this.getContext().destroyBean(this.innerCellRenderer);\n super.destroy();\n }\n refresh() {\n return false;\n }\n}\nGroupCellRenderer.TEMPLATE = `\n \n \n \n \n \n `;\n__decorate([\n RefSelector('eExpanded')\n], GroupCellRenderer.prototype, \"eExpanded\", void 0);\n__decorate([\n RefSelector('eContracted')\n], GroupCellRenderer.prototype, \"eContracted\", void 0);\n__decorate([\n RefSelector('eCheckbox')\n], GroupCellRenderer.prototype, \"eCheckbox\", void 0);\n__decorate([\n RefSelector('eValue')\n], GroupCellRenderer.prototype, \"eValue\", void 0);\n__decorate([\n RefSelector('eChildCount')\n], GroupCellRenderer.prototype, \"eChildCount\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from \"../../widgets/component.mjs\";\nimport { RefSelector } from \"../../widgets/componentAnnotations.mjs\";\nimport { createIconNoSpan } from \"../../utils/icon.mjs\";\nexport class LoadingCellRenderer extends Component {\n constructor() {\n super(LoadingCellRenderer.TEMPLATE);\n }\n init(params) {\n params.node.failedLoad ? this.setupFailed() : this.setupLoading();\n }\n setupFailed() {\n const localeTextFunc = this.localeService.getLocaleTextFunc();\n this.eLoadingText.innerText = localeTextFunc('loadingError', 'ERR');\n }\n setupLoading() {\n const eLoadingIcon = createIconNoSpan('groupLoading', this.gridOptionsService, null);\n if (eLoadingIcon) {\n this.eLoadingIcon.appendChild(eLoadingIcon);\n }\n const localeTextFunc = this.localeService.getLocaleTextFunc();\n this.eLoadingText.innerText = localeTextFunc('loadingOoo', 'Loading');\n }\n refresh(params) {\n return false;\n }\n // this is a user component, and IComponent has \"public destroy()\" as part of the interface.\n // so we need to override destroy() just to make the method public.\n destroy() {\n super.destroy();\n }\n}\nLoadingCellRenderer.TEMPLATE = `
\n \n \n
`;\n__decorate([\n RefSelector('eLoadingIcon')\n], LoadingCellRenderer.prototype, \"eLoadingIcon\", void 0);\n__decorate([\n RefSelector('eLoadingText')\n], LoadingCellRenderer.prototype, \"eLoadingText\", void 0);\n","import { Component } from \"../../widgets/component.mjs\";\nexport class LoadingOverlayComponent extends Component {\n constructor() {\n super();\n }\n // this is a user component, and IComponent has \"public destroy()\" as part of the interface.\n // so we need to override destroy() just to make the method public.\n destroy() {\n super.destroy();\n }\n init(params) {\n var _a;\n const template = (_a = this.gridOptionsService.get('overlayLoadingTemplate')) !== null && _a !== void 0 ? _a : LoadingOverlayComponent.DEFAULT_LOADING_OVERLAY_TEMPLATE;\n const localeTextFunc = this.localeService.getLocaleTextFunc();\n const localisedTemplate = template.replace('[LOADING...]', localeTextFunc('loadingOoo', 'Loading...'));\n this.setTemplate(localisedTemplate);\n }\n}\nLoadingOverlayComponent.DEFAULT_LOADING_OVERLAY_TEMPLATE = '[LOADING...]';\n","import { Component } from \"../../widgets/component.mjs\";\nexport class NoRowsOverlayComponent extends Component {\n constructor() {\n super();\n }\n // this is a user component, and IComponent has \"public destroy()\" as part of the interface.\n // so we need to override destroy() just to make the method public.\n destroy() {\n super.destroy();\n }\n init(params) {\n var _a;\n const template = (_a = this.gridOptionsService.get('overlayNoRowsTemplate')) !== null && _a !== void 0 ? _a : NoRowsOverlayComponent.DEFAULT_NO_ROWS_TEMPLATE;\n const localeTextFunc = this.localeService.getLocaleTextFunc();\n const localisedTemplate = template.replace('[NO_ROWS_TO_SHOW]', localeTextFunc('noRowsToShow', 'No Rows To Show'));\n this.setTemplate(localisedTemplate);\n }\n}\nNoRowsOverlayComponent.DEFAULT_NO_ROWS_TEMPLATE = '[NO_ROWS_TO_SHOW]';\n","import { PopupComponent } from '../widgets/popupComponent.mjs';\nimport { escapeString } from '../utils/string.mjs';\nexport class TooltipComponent extends PopupComponent {\n constructor() {\n super(/* html */ `
`);\n }\n // will need to type params\n init(params) {\n const { value } = params;\n this.getGui().innerHTML = escapeString(value);\n }\n}\n","import { SimpleCellEditor } from \"./simpleCellEditor.mjs\";\nimport { exists } from \"../../utils/generic.mjs\";\nclass NumberCellEditorInput {\n getTemplate() {\n return /* html */ ``;\n }\n init(eInput, params) {\n this.eInput = eInput;\n this.params = params;\n if (params.max != null) {\n eInput.setMax(params.max);\n }\n if (params.min != null) {\n eInput.setMin(params.min);\n }\n if (params.precision != null) {\n eInput.setPrecision(params.precision);\n }\n if (params.step != null) {\n eInput.setStep(params.step);\n }\n if (params.showStepperButtons) {\n eInput.getInputElement().classList.add('ag-number-field-input-stepper');\n }\n }\n getValue() {\n const value = this.eInput.getValue();\n if (!exists(value) && !exists(this.params.value)) {\n return this.params.value;\n }\n let parsedValue = this.params.parseValue(value);\n if (parsedValue == null) {\n return parsedValue;\n }\n if (typeof parsedValue === 'string') {\n if (parsedValue === '') {\n return null;\n }\n parsedValue = Number(parsedValue);\n }\n return isNaN(parsedValue) ? null : parsedValue;\n }\n getStartValue() {\n return this.params.value;\n }\n}\nexport class NumberCellEditor extends SimpleCellEditor {\n constructor() {\n super(new NumberCellEditorInput());\n }\n}\n","import { serialiseDate } from \"../../utils/date.mjs\";\nimport { SimpleCellEditor } from \"./simpleCellEditor.mjs\";\nimport { exists } from \"../../utils/generic.mjs\";\nclass DateCellEditorInput {\n getTemplate() {\n return /* html */ ``;\n }\n init(eInput, params) {\n this.eInput = eInput;\n this.params = params;\n if (params.min != null) {\n eInput.setMin(params.min);\n }\n if (params.max != null) {\n eInput.setMax(params.max);\n }\n if (params.step != null) {\n eInput.setStep(params.step);\n }\n }\n getValue() {\n const value = this.eInput.getDate();\n if (!exists(value) && !exists(this.params.value)) {\n return this.params.value;\n }\n return value !== null && value !== void 0 ? value : null;\n }\n getStartValue() {\n const { value } = this.params;\n if (!(value instanceof Date)) {\n return undefined;\n }\n return serialiseDate(value, false);\n }\n}\nexport class DateCellEditor extends SimpleCellEditor {\n constructor() {\n super(new DateCellEditorInput());\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired } from \"../../context/context.mjs\";\nimport { serialiseDate } from \"../../utils/date.mjs\";\nimport { SimpleCellEditor } from \"./simpleCellEditor.mjs\";\nimport { exists } from \"../../utils/generic.mjs\";\nclass DateStringCellEditorInput {\n constructor(getDataTypeService) {\n this.getDataTypeService = getDataTypeService;\n }\n getTemplate() {\n return /* html */ ``;\n }\n init(eInput, params) {\n this.eInput = eInput;\n this.params = params;\n if (params.min != null) {\n eInput.setMin(params.min);\n }\n if (params.max != null) {\n eInput.setMax(params.max);\n }\n if (params.step != null) {\n eInput.setStep(params.step);\n }\n }\n getValue() {\n const value = this.formatDate(this.eInput.getDate());\n if (!exists(value) && !exists(this.params.value)) {\n return this.params.value;\n }\n return this.params.parseValue(value !== null && value !== void 0 ? value : '');\n }\n getStartValue() {\n var _a, _b;\n return serialiseDate((_b = this.parseDate((_a = this.params.value) !== null && _a !== void 0 ? _a : undefined)) !== null && _b !== void 0 ? _b : null, false);\n }\n parseDate(value) {\n return this.getDataTypeService().getDateParserFunction()(value);\n }\n formatDate(value) {\n return this.getDataTypeService().getDateFormatterFunction()(value);\n }\n}\nexport class DateStringCellEditor extends SimpleCellEditor {\n constructor() {\n super(new DateStringCellEditorInput(() => this.dataTypeService));\n }\n}\n__decorate([\n Autowired('dataTypeService')\n], DateStringCellEditor.prototype, \"dataTypeService\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from \"../../widgets/component.mjs\";\nimport { RefSelector } from \"../../widgets/componentAnnotations.mjs\";\nimport { stopPropagationForAgGrid } from \"../../utils/event.mjs\";\nimport { Events } from \"../../events.mjs\";\nimport { KeyCode } from \"../../constants/keyCode.mjs\";\nimport { getAriaCheckboxStateName } from \"../../utils/aria.mjs\";\nimport { GROUP_AUTO_COLUMN_ID } from \"../../columns/autoGroupColService.mjs\";\nexport class CheckboxCellRenderer extends Component {\n constructor() {\n super(CheckboxCellRenderer.TEMPLATE);\n }\n init(params) {\n this.params = params;\n this.updateCheckbox(params);\n this.eCheckbox.getInputElement().setAttribute('tabindex', '-1');\n this.addManagedListener(this.eCheckbox.getInputElement(), 'click', (event) => {\n stopPropagationForAgGrid(event);\n if (this.eCheckbox.isDisabled()) {\n return;\n }\n const isSelected = this.eCheckbox.getValue();\n this.onCheckboxChanged(isSelected);\n });\n this.addManagedListener(this.eCheckbox.getInputElement(), 'dblclick', (event) => {\n stopPropagationForAgGrid(event);\n });\n const eDocument = this.gridOptionsService.getDocument();\n this.addManagedListener(this.params.eGridCell, 'keydown', (event) => {\n if (event.key === KeyCode.SPACE && !this.eCheckbox.isDisabled()) {\n if (this.params.eGridCell === eDocument.activeElement) {\n this.eCheckbox.toggle();\n }\n const isSelected = this.eCheckbox.getValue();\n this.onCheckboxChanged(isSelected);\n event.preventDefault();\n }\n });\n }\n refresh(params) {\n this.params = params;\n this.updateCheckbox(params);\n return true;\n }\n updateCheckbox(params) {\n var _a, _b, _c;\n let isSelected;\n let displayed = true;\n if (params.node.group && params.column) {\n const colId = params.column.getColId();\n if (colId.startsWith(GROUP_AUTO_COLUMN_ID)) {\n // if we're grouping by this column then the value is a string and we need to parse it\n isSelected = params.value == null || params.value === '' ? undefined : params.value === 'true';\n }\n else if (params.node.aggData && params.node.aggData[colId] !== undefined) {\n isSelected = (_a = params.value) !== null && _a !== void 0 ? _a : undefined;\n }\n else {\n displayed = false;\n }\n }\n else {\n isSelected = (_b = params.value) !== null && _b !== void 0 ? _b : undefined;\n }\n if (!displayed) {\n this.eCheckbox.setDisplayed(false);\n return;\n }\n this.eCheckbox.setValue(isSelected);\n const disabled = params.disabled != null ? params.disabled : !((_c = params.column) === null || _c === void 0 ? void 0 : _c.isCellEditable(params.node));\n this.eCheckbox.setDisabled(disabled);\n const translate = this.localeService.getLocaleTextFunc();\n const stateName = getAriaCheckboxStateName(translate, isSelected);\n const ariaLabel = disabled\n ? stateName\n : `${translate('ariaToggleCellValue', 'Press SPACE to toggle cell value')} (${stateName})`;\n this.eCheckbox.setInputAriaLabel(ariaLabel);\n }\n onCheckboxChanged(isSelected) {\n const { column, node, rowIndex, value } = this.params;\n const eventStarted = {\n type: Events.EVENT_CELL_EDITING_STARTED,\n column: column,\n colDef: column === null || column === void 0 ? void 0 : column.getColDef(),\n data: node.data,\n node,\n rowIndex,\n rowPinned: node.rowPinned,\n value\n };\n this.eventService.dispatchEvent(eventStarted);\n const valueChanged = this.params.node.setDataValue(this.params.column, isSelected, 'edit');\n const eventStopped = {\n type: Events.EVENT_CELL_EDITING_STOPPED,\n column: column,\n colDef: column === null || column === void 0 ? void 0 : column.getColDef(),\n data: node.data,\n node,\n rowIndex,\n rowPinned: node.rowPinned,\n value,\n oldValue: value,\n newValue: isSelected,\n valueChanged\n };\n this.eventService.dispatchEvent(eventStopped);\n }\n}\nCheckboxCellRenderer.TEMPLATE = `\n
\n \n
`;\n__decorate([\n RefSelector('eCheckbox')\n], CheckboxCellRenderer.prototype, \"eCheckbox\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PopupComponent } from \"../../widgets/popupComponent.mjs\";\nimport { RefSelector } from \"../../widgets/componentAnnotations.mjs\";\nimport { getAriaCheckboxStateName } from \"../../utils/aria.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nexport class CheckboxCellEditor extends PopupComponent {\n constructor() {\n super(/* html */ `\n
\n \n
`);\n }\n init(params) {\n var _a;\n this.params = params;\n const isSelected = (_a = params.value) !== null && _a !== void 0 ? _a : undefined;\n this.eCheckbox.setValue(isSelected);\n this.eCheckbox.getInputElement().setAttribute('tabindex', '-1');\n this.setAriaLabel(isSelected);\n this.addManagedListener(this.eCheckbox, Events.EVENT_FIELD_VALUE_CHANGED, (event) => this.setAriaLabel(event.selected));\n }\n getValue() {\n return this.eCheckbox.getValue();\n }\n focusIn() {\n this.eCheckbox.getFocusableElement().focus();\n }\n afterGuiAttached() {\n if (this.params.cellStartedEdit) {\n this.focusIn();\n }\n }\n isPopup() {\n return false;\n }\n setAriaLabel(isSelected) {\n const translate = this.localeService.getLocaleTextFunc();\n const stateName = getAriaCheckboxStateName(translate, isSelected);\n const ariaLabel = translate('ariaToggleCellValue', 'Press SPACE to toggle cell value');\n this.eCheckbox.setInputAriaLabel(`${ariaLabel} (${stateName})`);\n }\n}\n__decorate([\n RefSelector('eCheckbox')\n], CheckboxCellEditor.prototype, \"eCheckbox\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired, Bean, PostConstruct } from \"../../context/context.mjs\";\nimport { ReadOnlyFloatingFilter } from \"../../filter/floating/provided/readOnlyFloatingFilter.mjs\";\nimport { DateFilter } from \"../../filter/provided/date/dateFilter.mjs\";\nimport { DateFloatingFilter } from \"../../filter/provided/date/dateFloatingFilter.mjs\";\nimport { DefaultDateComponent } from \"../../filter/provided/date/defaultDateComponent.mjs\";\nimport { NumberFilter } from \"../../filter/provided/number/numberFilter.mjs\";\nimport { NumberFloatingFilter } from \"../../filter/provided/number/numberFloatingFilter.mjs\";\nimport { TextFilter } from \"../../filter/provided/text/textFilter.mjs\";\nimport { TextFloatingFilter } from \"../../filter/provided/text/textFloatingFilter.mjs\";\nimport { HeaderComp } from \"../../headerRendering/cells/column/headerComp.mjs\";\nimport { SortIndicatorComp } from \"../../headerRendering/cells/column/sortIndicatorComp.mjs\";\nimport { HeaderGroupComp } from \"../../headerRendering/cells/columnGroup/headerGroupComp.mjs\";\nimport { ModuleNames } from \"../../modules/moduleNames.mjs\";\nimport { ModuleRegistry } from \"../../modules/moduleRegistry.mjs\";\nimport { LargeTextCellEditor } from \"../../rendering/cellEditors/largeTextCellEditor.mjs\";\nimport { SelectCellEditor } from \"../../rendering/cellEditors/selectCellEditor.mjs\";\nimport { TextCellEditor } from \"../../rendering/cellEditors/textCellEditor.mjs\";\nimport { AnimateShowChangeCellRenderer } from \"../../rendering/cellRenderers/animateShowChangeCellRenderer.mjs\";\nimport { AnimateSlideCellRenderer } from \"../../rendering/cellRenderers/animateSlideCellRenderer.mjs\";\nimport { GroupCellRenderer } from \"../../rendering/cellRenderers/groupCellRenderer.mjs\";\nimport { LoadingCellRenderer } from \"../../rendering/cellRenderers/loadingCellRenderer.mjs\";\nimport { LoadingOverlayComponent } from \"../../rendering/overlays/loadingOverlayComponent.mjs\";\nimport { NoRowsOverlayComponent } from \"../../rendering/overlays/noRowsOverlayComponent.mjs\";\nimport { TooltipComponent } from \"../../rendering/tooltipComponent.mjs\";\nimport { doOnce } from \"../../utils/function.mjs\";\nimport { iterateObject } from '../../utils/object.mjs';\nimport { fuzzySuggestions } from '../../utils/fuzzyMatch.mjs';\nimport { NumberCellEditor } from \"../../rendering/cellEditors/numberCellEditor.mjs\";\nimport { DateCellEditor } from \"../../rendering/cellEditors/dateCellEditor.mjs\";\nimport { DateStringCellEditor } from \"../../rendering/cellEditors/dateStringCellEditor.mjs\";\nimport { CheckboxCellRenderer } from \"../../rendering/cellRenderers/checkboxCellRenderer.mjs\";\nimport { CheckboxCellEditor } from \"../../rendering/cellEditors/checkboxCellEditor.mjs\";\nlet UserComponentRegistry = class UserComponentRegistry extends BeanStub {\n constructor() {\n super(...arguments);\n this.agGridDefaults = {\n //date\n agDateInput: DefaultDateComponent,\n //header\n agColumnHeader: HeaderComp,\n agColumnGroupHeader: HeaderGroupComp,\n agSortIndicator: SortIndicatorComp,\n //floating filters\n agTextColumnFloatingFilter: TextFloatingFilter,\n agNumberColumnFloatingFilter: NumberFloatingFilter,\n agDateColumnFloatingFilter: DateFloatingFilter,\n agReadOnlyFloatingFilter: ReadOnlyFloatingFilter,\n // renderers\n agAnimateShowChangeCellRenderer: AnimateShowChangeCellRenderer,\n agAnimateSlideCellRenderer: AnimateSlideCellRenderer,\n agGroupCellRenderer: GroupCellRenderer,\n agGroupRowRenderer: GroupCellRenderer,\n agLoadingCellRenderer: LoadingCellRenderer,\n agCheckboxCellRenderer: CheckboxCellRenderer,\n //editors\n agCellEditor: TextCellEditor,\n agTextCellEditor: TextCellEditor,\n agNumberCellEditor: NumberCellEditor,\n agDateCellEditor: DateCellEditor,\n agDateStringCellEditor: DateStringCellEditor,\n agSelectCellEditor: SelectCellEditor,\n agLargeTextCellEditor: LargeTextCellEditor,\n agCheckboxCellEditor: CheckboxCellEditor,\n //filter\n agTextColumnFilter: TextFilter,\n agNumberColumnFilter: NumberFilter,\n agDateColumnFilter: DateFilter,\n //overlays\n agLoadingOverlay: LoadingOverlayComponent,\n agNoRowsOverlay: NoRowsOverlayComponent,\n // tooltips\n agTooltipComponent: TooltipComponent\n };\n /** Used to provide useful error messages if a user is trying to use an enterprise component without loading the module. */\n this.enterpriseAgDefaultCompsModule = {\n agSetColumnFilter: ModuleNames.SetFilterModule,\n agSetColumnFloatingFilter: ModuleNames.SetFilterModule,\n agMultiColumnFilter: ModuleNames.MultiFilterModule,\n agMultiColumnFloatingFilter: ModuleNames.MultiFilterModule,\n agGroupColumnFilter: ModuleNames.RowGroupingModule,\n agGroupColumnFloatingFilter: ModuleNames.RowGroupingModule,\n agRichSelect: ModuleNames.RichSelectModule,\n agRichSelectCellEditor: ModuleNames.RichSelectModule,\n agDetailCellRenderer: ModuleNames.MasterDetailModule,\n agSparklineCellRenderer: ModuleNames.SparklinesModule\n };\n this.jsComps = {};\n }\n init() {\n if (this.gridOptions.components != null) {\n iterateObject(this.gridOptions.components, (key, component) => this.registerJsComponent(key, component));\n }\n }\n registerDefaultComponent(name, component) {\n if (this.agGridDefaults[name]) {\n console.error(`Trying to overwrite a default component. You should call registerComponent`);\n return;\n }\n this.agGridDefaults[name] = component;\n }\n registerJsComponent(name, component) {\n this.jsComps[name] = component;\n }\n retrieve(propertyName, name) {\n const createResult = (component, componentFromFramework) => ({ componentFromFramework, component });\n // FrameworkOverrides.frameworkComponent() is used in two locations:\n // 1) for Vue, user provided components get registered via a framework specific way.\n // 2) for React, it's how the React UI provides alternative default components (eg GroupCellRenderer and DetailCellRenderer)\n const registeredViaFrameworkComp = this.getFrameworkOverrides().frameworkComponent(name, this.gridOptions.components);\n if (registeredViaFrameworkComp != null) {\n return createResult(registeredViaFrameworkComp, true);\n }\n const jsComponent = this.jsComps[name];\n if (jsComponent) {\n const isFwkComp = this.getFrameworkOverrides().isFrameworkComponent(jsComponent);\n return createResult(jsComponent, isFwkComp);\n }\n const defaultComponent = this.agGridDefaults[name];\n if (defaultComponent) {\n return createResult(defaultComponent, false);\n }\n const moduleForComponent = this.enterpriseAgDefaultCompsModule[name];\n if (moduleForComponent) {\n ModuleRegistry.__assertRegistered(moduleForComponent, `AG Grid '${propertyName}' component: ${name}`, this.context.getGridId());\n }\n else {\n doOnce(() => { this.warnAboutMissingComponent(propertyName, name); }, \"MissingComp\" + name);\n }\n return null;\n }\n warnAboutMissingComponent(propertyName, componentName) {\n const validComponents = [\n // Don't include the old names / internals in potential suggestions\n ...Object.keys(this.agGridDefaults).filter(k => !['agCellEditor', 'agGroupRowRenderer', 'agSortIndicator'].includes(k)),\n ...Object.keys(this.jsComps)\n ];\n const suggestions = fuzzySuggestions(componentName, validComponents, true, 0.8);\n console.warn(`AG Grid: Could not find '${componentName}' component. It was configured as \"${propertyName}: '${componentName}'\" but it wasn't found in the list of registered components.`);\n if (suggestions.length > 0) {\n console.warn(` Did you mean: [${suggestions.slice(0, 3)}]?`);\n }\n console.warn(`If using a custom component check it has been registered as described in: https://ag-grid.com/javascript-data-grid/components/`);\n }\n};\n__decorate([\n Autowired('gridOptions')\n], UserComponentRegistry.prototype, \"gridOptions\", void 0);\n__decorate([\n PostConstruct\n], UserComponentRegistry.prototype, \"init\", null);\nUserComponentRegistry = __decorate([\n Bean('userComponentRegistry')\n], UserComponentRegistry);\nexport { UserComponentRegistry };\n","export const DateComponent = {\n propertyName: 'dateComponent',\n cellRenderer: false\n};\nexport const HeaderComponent = {\n propertyName: 'headerComponent',\n cellRenderer: false\n};\nexport const HeaderGroupComponent = {\n propertyName: 'headerGroupComponent',\n cellRenderer: false\n};\nexport const CellRendererComponent = {\n propertyName: 'cellRenderer',\n cellRenderer: true\n};\nexport const CellEditorComponent = {\n propertyName: 'cellEditor',\n cellRenderer: false\n};\nexport const InnerRendererComponent = {\n propertyName: 'innerRenderer',\n cellRenderer: true\n};\nexport const LoadingOverlayComponent = {\n propertyName: 'loadingOverlayComponent',\n cellRenderer: false\n};\nexport const NoRowsOverlayComponent = {\n propertyName: 'noRowsOverlayComponent',\n cellRenderer: false\n};\nexport const TooltipComponent = {\n propertyName: 'tooltipComponent',\n cellRenderer: false\n};\nexport const FilterComponent = {\n propertyName: 'filter',\n cellRenderer: false\n};\nexport const FloatingFilterComponent = {\n propertyName: 'floatingFilterComponent',\n cellRenderer: false\n};\nexport const ToolPanelComponent = {\n propertyName: 'toolPanel',\n cellRenderer: false\n};\nexport const StatusPanelComponent = {\n propertyName: 'statusPanel',\n cellRenderer: false\n};\nexport const FullWidth = {\n propertyName: 'fullWidthCellRenderer',\n cellRenderer: true\n};\nexport const FullWidthLoading = {\n propertyName: 'loadingCellRenderer',\n cellRenderer: true\n};\nexport const FullWidthGroup = {\n propertyName: 'groupRowRenderer',\n cellRenderer: true\n};\nexport const FullWidthDetail = {\n propertyName: 'detailCellRenderer',\n cellRenderer: true\n};\n","export class FloatingFilterMapper {\n static getFloatingFilterType(filterType) {\n return this.filterToFloatingFilterMapping[filterType];\n }\n}\nFloatingFilterMapper.filterToFloatingFilterMapping = {\n set: 'agSetColumnFloatingFilter',\n agSetColumnFilter: 'agSetColumnFloatingFilter',\n multi: 'agMultiColumnFloatingFilter',\n agMultiColumnFilter: 'agMultiColumnFloatingFilter',\n group: 'agGroupColumnFloatingFilter',\n agGroupColumnFilter: 'agGroupColumnFloatingFilter',\n number: 'agNumberColumnFloatingFilter',\n agNumberColumnFilter: 'agNumberColumnFloatingFilter',\n date: 'agDateColumnFloatingFilter',\n agDateColumnFilter: 'agDateColumnFloatingFilter',\n text: 'agTextColumnFloatingFilter',\n agTextColumnFilter: 'agTextColumnFloatingFilter'\n};\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired, Bean, Optional } from \"../../context/context.mjs\";\nimport { AgPromise } from \"../../utils/index.mjs\";\nimport { mergeDeep } from '../../utils/object.mjs';\nimport { CellEditorComponent, CellRendererComponent, DateComponent, FilterComponent, FloatingFilterComponent, FullWidth, FullWidthDetail, FullWidthGroup, FullWidthLoading, HeaderComponent, HeaderGroupComponent, InnerRendererComponent, LoadingOverlayComponent, NoRowsOverlayComponent, StatusPanelComponent, ToolPanelComponent, TooltipComponent } from \"./componentTypes.mjs\";\nimport { FloatingFilterMapper } from '../../filter/floating/floatingFilterMapper.mjs';\nlet UserComponentFactory = class UserComponentFactory extends BeanStub {\n getHeaderCompDetails(colDef, params) {\n return this.getCompDetails(colDef, HeaderComponent, 'agColumnHeader', params);\n }\n getHeaderGroupCompDetails(params) {\n const colGroupDef = params.columnGroup.getColGroupDef();\n return this.getCompDetails(colGroupDef, HeaderGroupComponent, 'agColumnGroupHeader', params);\n }\n // this one is unusual, as it can be LoadingCellRenderer, DetailCellRenderer, FullWidthCellRenderer or GroupRowRenderer.\n // so we have to pass the type in.\n getFullWidthCellRendererDetails(params) {\n return this.getCompDetails(this.gridOptions, FullWidth, null, params, true);\n }\n getFullWidthLoadingCellRendererDetails(params) {\n return this.getCompDetails(this.gridOptions, FullWidthLoading, 'agLoadingCellRenderer', params, true);\n }\n getFullWidthGroupCellRendererDetails(params) {\n return this.getCompDetails(this.gridOptions, FullWidthGroup, 'agGroupRowRenderer', params, true);\n }\n getFullWidthDetailCellRendererDetails(params) {\n return this.getCompDetails(this.gridOptions, FullWidthDetail, 'agDetailCellRenderer', params, true);\n }\n // CELL RENDERER\n getInnerRendererDetails(def, params) {\n return this.getCompDetails(def, InnerRendererComponent, null, params);\n }\n getFullWidthGroupRowInnerCellRenderer(def, params) {\n return this.getCompDetails(def, InnerRendererComponent, null, params);\n }\n getCellRendererDetails(def, params) {\n return this.getCompDetails(def, CellRendererComponent, null, params);\n }\n // CELL EDITOR\n getCellEditorDetails(def, params) {\n return this.getCompDetails(def, CellEditorComponent, 'agCellEditor', params, true);\n }\n // FILTER\n getFilterDetails(def, params, defaultFilter) {\n return this.getCompDetails(def, FilterComponent, defaultFilter, params, true);\n }\n getDateCompDetails(params) {\n return this.getCompDetails(this.gridOptions, DateComponent, 'agDateInput', params, true);\n }\n getLoadingOverlayCompDetails(params) {\n return this.getCompDetails(this.gridOptions, LoadingOverlayComponent, 'agLoadingOverlay', params, true);\n }\n getNoRowsOverlayCompDetails(params) {\n return this.getCompDetails(this.gridOptions, NoRowsOverlayComponent, 'agNoRowsOverlay', params, true);\n }\n getTooltipCompDetails(params) {\n return this.getCompDetails(params.colDef, TooltipComponent, 'agTooltipComponent', params, true);\n }\n getSetFilterCellRendererDetails(def, params) {\n return this.getCompDetails(def, CellRendererComponent, null, params);\n }\n getFloatingFilterCompDetails(def, params, defaultFloatingFilter) {\n return this.getCompDetails(def, FloatingFilterComponent, defaultFloatingFilter, params);\n }\n getToolPanelCompDetails(toolPanelDef, params) {\n return this.getCompDetails(toolPanelDef, ToolPanelComponent, null, params, true);\n }\n getStatusPanelCompDetails(def, params) {\n return this.getCompDetails(def, StatusPanelComponent, null, params, true);\n }\n getCompDetails(defObject, type, defaultName, params, mandatory = false) {\n const { propertyName, cellRenderer } = type;\n let { compName, jsComp, fwComp, paramsFromSelector, popupFromSelector, popupPositionFromSelector } = this.getCompKeys(defObject, type, params);\n const lookupFromRegistry = (key) => {\n const item = this.userComponentRegistry.retrieve(propertyName, key);\n if (item) {\n jsComp = !item.componentFromFramework ? item.component : undefined;\n fwComp = item.componentFromFramework ? item.component : undefined;\n }\n };\n // if compOption is a string, means we need to look the item up\n if (compName != null) {\n lookupFromRegistry(compName);\n }\n // if lookup brought nothing back, and we have a default, lookup the default\n if (jsComp == null && fwComp == null && defaultName != null) {\n lookupFromRegistry(defaultName);\n }\n // if we have a comp option, and it's a function, replace it with an object equivalent adaptor\n if (jsComp && cellRenderer && !this.agComponentUtils.doesImplementIComponent(jsComp)) {\n jsComp = this.agComponentUtils.adaptFunction(propertyName, jsComp);\n }\n if (!jsComp && !fwComp) {\n if (mandatory) {\n console.error(`AG Grid: Could not find component ${compName}, did you forget to configure this component?`);\n }\n return;\n }\n const paramsMerged = this.mergeParamsWithApplicationProvidedParams(defObject, type, params, paramsFromSelector);\n const componentFromFramework = jsComp == null;\n const componentClass = jsComp ? jsComp : fwComp;\n return {\n componentFromFramework,\n componentClass,\n params: paramsMerged,\n type: type,\n popupFromSelector,\n popupPositionFromSelector,\n newAgStackInstance: () => this.newAgStackInstance(componentClass, componentFromFramework, paramsMerged, type)\n };\n }\n getCompKeys(defObject, type, params) {\n const { propertyName } = type;\n let compName;\n let jsComp;\n let fwComp;\n let paramsFromSelector;\n let popupFromSelector;\n let popupPositionFromSelector;\n // there are two types of js comps, class based and func based. we can only check for\n // class based, by checking if getGui() exists. no way to differentiate js func based vs eg react func based\n // const isJsClassComp = (comp: any) => this.agComponentUtils.doesImplementIComponent(comp);\n // const fwActive = this.frameworkComponentWrapper != null;\n // pull from defObject if available\n if (defObject) {\n const defObjectAny = defObject;\n // if selector, use this\n const selectorFunc = defObjectAny[propertyName + 'Selector'];\n const selectorRes = selectorFunc ? selectorFunc(params) : null;\n const assignComp = (providedJsComp) => {\n if (typeof providedJsComp === 'string') {\n compName = providedJsComp;\n }\n else if (providedJsComp != null && providedJsComp !== true) {\n const isFwkComp = this.getFrameworkOverrides().isFrameworkComponent(providedJsComp);\n if (isFwkComp) {\n fwComp = providedJsComp;\n }\n else {\n jsComp = providedJsComp;\n }\n }\n };\n if (selectorRes) {\n assignComp(selectorRes.component);\n paramsFromSelector = selectorRes.params;\n popupFromSelector = selectorRes.popup;\n popupPositionFromSelector = selectorRes.popupPosition;\n }\n else {\n // if no selector, or result of selector is empty, take from defObject\n assignComp(defObjectAny[propertyName]);\n }\n }\n return { compName, jsComp, fwComp, paramsFromSelector, popupFromSelector, popupPositionFromSelector };\n }\n newAgStackInstance(ComponentClass, componentFromFramework, params, type) {\n const propertyName = type.propertyName;\n const jsComponent = !componentFromFramework;\n // using javascript component\n let instance;\n if (jsComponent) {\n instance = new ComponentClass();\n }\n else {\n // Using framework component\n const thisComponentConfig = this.componentMetadataProvider.retrieve(propertyName);\n instance = this.frameworkComponentWrapper.wrap(ComponentClass, thisComponentConfig.mandatoryMethodList, thisComponentConfig.optionalMethodList, type);\n }\n const deferredInit = this.initComponent(instance, params);\n if (deferredInit == null) {\n return AgPromise.resolve(instance);\n }\n return deferredInit.then(() => instance);\n }\n // used by Floating Filter\n mergeParamsWithApplicationProvidedParams(defObject, type, paramsFromGrid, paramsFromSelector = null) {\n const params = {\n context: this.gridOptionsService.context,\n columnApi: this.gridOptionsService.columnApi,\n api: this.gridOptionsService.api\n };\n mergeDeep(params, paramsFromGrid);\n // pull user params from either the old prop name and new prop name\n // eg either cellRendererParams and cellCompParams\n const defObjectAny = defObject;\n const userParams = defObjectAny && defObjectAny[type.propertyName + 'Params'];\n if (typeof userParams === 'function') {\n const userParamsFromFunc = userParams(paramsFromGrid);\n mergeDeep(params, userParamsFromFunc);\n }\n else if (typeof userParams === 'object') {\n mergeDeep(params, userParams);\n }\n mergeDeep(params, paramsFromSelector);\n return params;\n }\n initComponent(component, params) {\n this.context.createBean(component);\n if (component.init == null) {\n return;\n }\n return component.init(params);\n }\n getDefaultFloatingFilterType(def, getFromDefault) {\n if (def == null) {\n return null;\n }\n let defaultFloatingFilterType = null;\n let { compName, jsComp, fwComp } = this.getCompKeys(def, FilterComponent);\n if (compName) {\n // will be undefined if not in the map\n defaultFloatingFilterType = FloatingFilterMapper.getFloatingFilterType(compName);\n }\n else {\n const usingDefaultFilter = (jsComp == null && fwComp == null) && (def.filter === true);\n if (usingDefaultFilter) {\n defaultFloatingFilterType = getFromDefault();\n }\n }\n return defaultFloatingFilterType;\n }\n};\n__decorate([\n Autowired('gridOptions')\n], UserComponentFactory.prototype, \"gridOptions\", void 0);\n__decorate([\n Autowired('agComponentUtils')\n], UserComponentFactory.prototype, \"agComponentUtils\", void 0);\n__decorate([\n Autowired('componentMetadataProvider')\n], UserComponentFactory.prototype, \"componentMetadataProvider\", void 0);\n__decorate([\n Autowired('userComponentRegistry')\n], UserComponentFactory.prototype, \"userComponentRegistry\", void 0);\n__decorate([\n Optional('frameworkComponentWrapper')\n], UserComponentFactory.prototype, \"frameworkComponentWrapper\", void 0);\nUserComponentFactory = __decorate([\n Bean('userComponentFactory')\n], UserComponentFactory);\nexport { UserComponentFactory };\n","// Excel Export\nexport var ExcelFactoryMode;\n(function (ExcelFactoryMode) {\n ExcelFactoryMode[ExcelFactoryMode[\"SINGLE_SHEET\"] = 0] = \"SINGLE_SHEET\";\n ExcelFactoryMode[ExcelFactoryMode[\"MULTI_SHEET\"] = 1] = \"MULTI_SHEET\";\n})(ExcelFactoryMode || (ExcelFactoryMode = {}));\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean, PreDestroy, Autowired } from \"../context/context.mjs\";\nimport { Events } from \"../events.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nimport { removeFromArray } from \"../utils/array.mjs\";\nimport { areEventsNear } from \"../utils/mouse.mjs\";\nimport { isBrowserSafari } from \"../utils/browser.mjs\";\nimport { isFocusableFormField } from \"../utils/dom.mjs\";\n/** Adds drag listening onto an element. In AG Grid this is used twice, first is resizing columns,\n * second is moving the columns and column groups around (ie the 'drag' part of Drag and Drop. */\nlet DragService = class DragService extends BeanStub {\n constructor() {\n super(...arguments);\n this.dragEndFunctions = [];\n this.dragSources = [];\n }\n removeAllListeners() {\n this.dragSources.forEach(this.removeListener.bind(this));\n this.dragSources.length = 0;\n }\n removeListener(dragSourceAndListener) {\n const element = dragSourceAndListener.dragSource.eElement;\n const mouseDownListener = dragSourceAndListener.mouseDownListener;\n element.removeEventListener('mousedown', mouseDownListener);\n // remove touch listener only if it exists\n if (dragSourceAndListener.touchEnabled) {\n const touchStartListener = dragSourceAndListener.touchStartListener;\n element.removeEventListener('touchstart', touchStartListener, { passive: true });\n }\n }\n removeDragSource(params) {\n const dragSourceAndListener = this.dragSources.find(item => item.dragSource === params);\n if (!dragSourceAndListener) {\n return;\n }\n this.removeListener(dragSourceAndListener);\n removeFromArray(this.dragSources, dragSourceAndListener);\n }\n isDragging() {\n return this.dragging;\n }\n addDragSource(params) {\n const mouseListener = this.onMouseDown.bind(this, params);\n const { eElement, includeTouch, stopPropagationForTouch } = params;\n eElement.addEventListener('mousedown', mouseListener);\n let touchListener = null;\n const suppressTouch = this.gridOptionsService.is('suppressTouch');\n if (includeTouch && !suppressTouch) {\n touchListener = (touchEvent) => {\n if (isFocusableFormField(touchEvent.target)) {\n return;\n }\n if (touchEvent.cancelable) {\n touchEvent.preventDefault();\n if (stopPropagationForTouch) {\n touchEvent.stopPropagation();\n }\n }\n this.onTouchStart(params, touchEvent);\n };\n // we set passive=false, as we want to prevent default on this event\n eElement.addEventListener('touchstart', touchListener, { passive: false });\n }\n this.dragSources.push({\n dragSource: params,\n mouseDownListener: mouseListener,\n touchStartListener: touchListener,\n touchEnabled: !!includeTouch\n });\n }\n getStartTarget() {\n return this.startTarget;\n }\n // gets called whenever mouse down on any drag source\n onTouchStart(params, touchEvent) {\n this.currentDragParams = params;\n this.dragging = false;\n const touch = touchEvent.touches[0];\n this.touchLastTime = touch;\n this.touchStart = touch;\n const touchMoveEvent = (e) => this.onTouchMove(e, params.eElement);\n const touchEndEvent = (e) => this.onTouchUp(e, params.eElement);\n const documentTouchMove = (e) => { if (e.cancelable) {\n e.preventDefault();\n } };\n const target = touchEvent.target;\n const events = [\n // Prevents the page document from moving while we are dragging items around.\n // preventDefault needs to be called in the touchmove listener and never inside the\n // touchstart, because using touchstart causes the click event to be cancelled on touch devices.\n { target: this.gridOptionsService.getRootNode(), type: 'touchmove', listener: documentTouchMove, options: { passive: false } },\n { target, type: 'touchmove', listener: touchMoveEvent, options: { passive: true } },\n { target, type: 'touchend', listener: touchEndEvent, options: { passive: true } },\n { target, type: 'touchcancel', listener: touchEndEvent, options: { passive: true } }\n ];\n // temporally add these listeners, for the duration of the drag\n this.addTemporaryEvents(events);\n // see if we want to start dragging straight away\n if (params.dragStartPixels === 0) {\n this.onCommonMove(touch, this.touchStart, params.eElement);\n }\n }\n // gets called whenever mouse down on any drag source\n onMouseDown(params, mouseEvent) {\n const e = mouseEvent;\n if (params.skipMouseEvent && params.skipMouseEvent(mouseEvent)) {\n return;\n }\n // if there are two elements with parent / child relationship, and both are draggable,\n // when we drag the child, we should NOT drag the parent. an example of this is row moving\n // and range selection - row moving should get preference when use drags the rowDrag component.\n if (e._alreadyProcessedByDragService) {\n return;\n }\n e._alreadyProcessedByDragService = true;\n // only interested in left button clicks\n if (mouseEvent.button !== 0) {\n return;\n }\n if (this.shouldPreventMouseEvent(mouseEvent)) {\n mouseEvent.preventDefault();\n }\n this.currentDragParams = params;\n this.dragging = false;\n this.mouseStartEvent = mouseEvent;\n this.startTarget = mouseEvent.target;\n const mouseMoveEvent = (event) => this.onMouseMove(event, params.eElement);\n const mouseUpEvent = (event) => this.onMouseUp(event, params.eElement);\n const contextEvent = (event) => event.preventDefault();\n const target = this.gridOptionsService.getRootNode();\n const events = [\n { target, type: 'mousemove', listener: mouseMoveEvent },\n { target, type: 'mouseup', listener: mouseUpEvent },\n { target, type: 'contextmenu', listener: contextEvent }\n ];\n // temporally add these listeners, for the duration of the drag\n this.addTemporaryEvents(events);\n //see if we want to start dragging straight away\n if (params.dragStartPixels === 0) {\n this.onMouseMove(mouseEvent, params.eElement);\n }\n }\n addTemporaryEvents(events) {\n events.forEach((currentEvent) => {\n const { target, type, listener, options } = currentEvent;\n target.addEventListener(type, listener, options);\n });\n this.dragEndFunctions.push(() => {\n events.forEach((currentEvent) => {\n const { target, type, listener, options } = currentEvent;\n target.removeEventListener(type, listener, options);\n });\n });\n }\n // returns true if the event is close to the original event by X pixels either vertically or horizontally.\n // we only start dragging after X pixels so this allows us to know if we should start dragging yet.\n isEventNearStartEvent(currentEvent, startEvent) {\n // by default, we wait 4 pixels before starting the drag\n const { dragStartPixels } = this.currentDragParams;\n const requiredPixelDiff = exists(dragStartPixels) ? dragStartPixels : 4;\n return areEventsNear(currentEvent, startEvent, requiredPixelDiff);\n }\n getFirstActiveTouch(touchList) {\n for (let i = 0; i < touchList.length; i++) {\n if (touchList[i].identifier === this.touchStart.identifier) {\n return touchList[i];\n }\n }\n return null;\n }\n onCommonMove(currentEvent, startEvent, el) {\n if (!this.dragging) {\n // if mouse hasn't travelled from the start position enough, do nothing\n if (!this.dragging && this.isEventNearStartEvent(currentEvent, startEvent)) {\n return;\n }\n this.dragging = true;\n const event = {\n type: Events.EVENT_DRAG_STARTED,\n target: el\n };\n this.eventService.dispatchEvent(event);\n this.currentDragParams.onDragStart(startEvent);\n // we need ONE drag action at the startEvent, so that we are guaranteed the drop target\n // at the start gets notified. this is because the drag can start outside of the element\n // that started it, as the mouse is allowed drag away from the mouse down before it's\n // considered a drag (the isEventNearStartEvent() above). if we didn't do this, then\n // it would be possible to click a column by the edge, then drag outside of the drop zone\n // in less than 4 pixels and the drag officially starts outside of the header but the header\n // wouldn't be notified of the dragging.\n this.currentDragParams.onDragging(startEvent);\n }\n this.currentDragParams.onDragging(currentEvent);\n }\n onTouchMove(touchEvent, el) {\n const touch = this.getFirstActiveTouch(touchEvent.touches);\n if (!touch) {\n return;\n }\n // this.___statusPanel.setInfoText(Math.random() + ' onTouchMove preventDefault stopPropagation');\n this.onCommonMove(touch, this.touchStart, el);\n }\n // only gets called after a mouse down - as this is only added after mouseDown\n // and is removed when mouseUp happens\n onMouseMove(mouseEvent, el) {\n if (this.shouldPreventMouseEvent(mouseEvent)) {\n mouseEvent.preventDefault();\n }\n this.onCommonMove(mouseEvent, this.mouseStartEvent, el);\n }\n shouldPreventMouseEvent(mouseEvent) {\n const isEnableCellTextSelect = this.gridOptionsService.is('enableCellTextSelection');\n const isSafari = isBrowserSafari();\n const isMouseMove = mouseEvent.type === 'mousemove';\n return (\n // when `isEnableCellTextSelect` is `true`, we need to preventDefault on mouseMove\n // to avoid the grid text being selected while dragging components.\n // Note: Safari also has an issue, where `user-select: none` is not being respected, so also\n // prevent it on MouseDown.\n ((isEnableCellTextSelect && isMouseMove) || isSafari) &&\n mouseEvent.cancelable &&\n this.mouseEventService.isEventFromThisGrid(mouseEvent) &&\n !this.isOverFormFieldElement(mouseEvent));\n }\n isOverFormFieldElement(mouseEvent) {\n const el = mouseEvent.target;\n const tagName = el === null || el === void 0 ? void 0 : el.tagName.toLocaleLowerCase();\n return !!(tagName === null || tagName === void 0 ? void 0 : tagName.match('^a$|textarea|input|select|button'));\n }\n onTouchUp(touchEvent, el) {\n let touch = this.getFirstActiveTouch(touchEvent.changedTouches);\n // i haven't worked this out yet, but there is no matching touch\n // when we get the touch up event. to get around this, we swap in\n // the last touch. this is a hack to 'get it working' while we\n // figure out what's going on, why we are not getting a touch in\n // current event.\n if (!touch) {\n touch = this.touchLastTime;\n }\n // if mouse was left up before we started to move, then this is a tap.\n // we check this before onUpCommon as onUpCommon resets the dragging\n // let tap = !this.dragging;\n // let tapTarget = this.currentDragParams.eElement;\n this.onUpCommon(touch, el);\n // if tap, tell user\n // console.log(`${Math.random()} tap = ${tap}`);\n // if (tap) {\n // tapTarget.click();\n // }\n }\n onMouseUp(mouseEvent, el) {\n this.onUpCommon(mouseEvent, el);\n }\n onUpCommon(eventOrTouch, el) {\n if (this.dragging) {\n this.dragging = false;\n this.currentDragParams.onDragStop(eventOrTouch);\n const event = {\n type: Events.EVENT_DRAG_STOPPED,\n target: el\n };\n this.eventService.dispatchEvent(event);\n }\n this.mouseStartEvent = null;\n this.startTarget = null;\n this.touchStart = null;\n this.touchLastTime = null;\n this.currentDragParams = null;\n this.dragEndFunctions.forEach(func => func());\n this.dragEndFunctions.length = 0;\n }\n};\n__decorate([\n Autowired('mouseEventService')\n], DragService.prototype, \"mouseEventService\", void 0);\n__decorate([\n PreDestroy\n], DragService.prototype, \"removeAllListeners\", null);\nDragService = __decorate([\n Bean('dragService')\n], DragService);\nexport { DragService };\n","export var RowHighlightPosition;\n(function (RowHighlightPosition) {\n RowHighlightPosition[RowHighlightPosition[\"Above\"] = 0] = \"Above\";\n RowHighlightPosition[RowHighlightPosition[\"Below\"] = 1] = \"Below\";\n})(RowHighlightPosition || (RowHighlightPosition = {}));\n","export var ClientSideRowModelSteps;\n(function (ClientSideRowModelSteps) {\n ClientSideRowModelSteps[\"EVERYTHING\"] = \"group\";\n ClientSideRowModelSteps[\"FILTER\"] = \"filter\";\n ClientSideRowModelSteps[\"SORT\"] = \"sort\";\n ClientSideRowModelSteps[\"MAP\"] = \"map\";\n ClientSideRowModelSteps[\"AGGREGATE\"] = \"aggregate\";\n ClientSideRowModelSteps[\"FILTER_AGGREGATES\"] = \"filter_aggregates\";\n ClientSideRowModelSteps[\"PIVOT\"] = \"pivot\";\n ClientSideRowModelSteps[\"NOTHING\"] = \"nothing\";\n})(ClientSideRowModelSteps || (ClientSideRowModelSteps = {}));\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, Optional, PostConstruct, PreDestroy } from \"./context/context.mjs\";\nimport { logDeprecation } from \"./gridOptionsValidator.mjs\";\nimport { ClientSideRowModelSteps } from \"./interfaces/iClientSideRowModel.mjs\";\nimport { ExcelFactoryMode } from \"./interfaces/iExcelCreator.mjs\";\nimport { ModuleNames } from \"./modules/moduleNames.mjs\";\nimport { ModuleRegistry } from \"./modules/moduleRegistry.mjs\";\nimport { exists, missing } from \"./utils/generic.mjs\";\nimport { iterateObject, removeAllReferences } from \"./utils/object.mjs\";\nexport function unwrapUserComp(comp) {\n const compAsAny = comp;\n const isProxy = compAsAny != null && compAsAny.getFrameworkComponentInstance != null;\n return isProxy ? compAsAny.getFrameworkComponentInstance() : comp;\n}\nlet GridApi = class GridApi {\n constructor() {\n this.detailGridInfoMap = {};\n this.destroyCalled = false;\n }\n registerOverlayWrapperComp(overlayWrapperComp) {\n this.overlayWrapperComp = overlayWrapperComp;\n }\n registerSideBarComp(sideBarComp) {\n this.sideBarComp = sideBarComp;\n }\n init() {\n switch (this.rowModel.getType()) {\n case 'clientSide':\n this.clientSideRowModel = this.rowModel;\n break;\n case 'infinite':\n this.infiniteRowModel = this.rowModel;\n break;\n case 'serverSide':\n this.serverSideRowModel = this.rowModel;\n break;\n }\n this.ctrlsService.whenReady(() => {\n this.gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();\n });\n }\n /** Used internally by grid. Not intended to be used by the client. Interface may change between releases. */\n __getAlignedGridService() {\n return this.alignedGridsService;\n }\n /** Used internally by grid. Not intended to be used by the client. Interface may change between releases. */\n __getContext() {\n return this.context;\n }\n getSetterMethod(key) {\n return `set${key.charAt(0).toUpperCase()}${key.substring(1)}`;\n }\n /** Used internally by grid. Not intended to be used by the client. Interface may change between releases. */\n __setProperty(propertyName, value) {\n // Ensure the GridOptions property gets updated and fires the change event as we\n // cannot assume that the dynamic Api call will updated GridOptions.\n this.gos.set(propertyName, value);\n // If the dynamic api does update GridOptions then change detection in the \n // GridOptionsService will prevent the event being fired twice.\n const setterName = this.getSetterMethod(propertyName);\n const dynamicApi = this;\n if (dynamicApi[setterName]) {\n dynamicApi[setterName](value);\n }\n }\n /** Returns the `gridId` for the current grid as specified via the gridOptions property `gridId` or the auto assigned grid id if none was provided. */\n getGridId() {\n return this.context.getGridId();\n }\n /** Register a detail grid with the master grid when it is created. */\n addDetailGridInfo(id, gridInfo) {\n this.detailGridInfoMap[id] = gridInfo;\n }\n /** Unregister a detail grid from the master grid when it is destroyed. */\n removeDetailGridInfo(id) {\n this.detailGridInfoMap[id] = undefined;\n }\n /** Returns the `DetailGridInfo` corresponding to the supplied `detailGridId`. */\n getDetailGridInfo(id) {\n return this.detailGridInfoMap[id];\n }\n /** Iterates through each `DetailGridInfo` in the grid and calls the supplied callback on each. */\n forEachDetailGridInfo(callback) {\n let index = 0;\n iterateObject(this.detailGridInfoMap, (id, gridInfo) => {\n // check for undefined, as old references will still be lying around\n if (exists(gridInfo)) {\n callback(gridInfo, index);\n index++;\n }\n });\n }\n /** Similar to `exportDataAsCsv`, except returns the result as a string rather than download it. */\n getDataAsCsv(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.CsvExportModule, 'api.getDataAsCsv', this.context.getGridId())) {\n return this.csvCreator.getDataAsCsv(params);\n }\n }\n /** Downloads a CSV export of the grid's data. */\n exportDataAsCsv(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.CsvExportModule, 'api.exportDataAsCSv', this.context.getGridId())) {\n this.csvCreator.exportDataAsCsv(params);\n }\n }\n getExcelExportMode(params) {\n const baseParams = this.gos.get('defaultExcelExportParams');\n const mergedParams = Object.assign({ exportMode: 'xlsx' }, baseParams, params);\n return mergedParams.exportMode;\n }\n assertNotExcelMultiSheet(method, params) {\n if (!ModuleRegistry.__assertRegistered(ModuleNames.ExcelExportModule, 'api.' + method, this.context.getGridId())) {\n return false;\n }\n const exportMode = this.getExcelExportMode(params);\n if (this.excelCreator.getFactoryMode(exportMode) === ExcelFactoryMode.MULTI_SHEET) {\n console.warn(\"AG Grid: The Excel Exporter is currently on Multi Sheet mode. End that operation by calling 'api.getMultipleSheetAsExcel()' or 'api.exportMultipleSheetsAsExcel()'\");\n return false;\n }\n return true;\n }\n /** Similar to `exportDataAsExcel`, except instead of downloading a file, it will return a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) to be processed by the user. */\n getDataAsExcel(params) {\n if (this.assertNotExcelMultiSheet('getDataAsExcel', params)) {\n return this.excelCreator.getDataAsExcel(params);\n }\n }\n /** Downloads an Excel export of the grid's data. */\n exportDataAsExcel(params) {\n if (this.assertNotExcelMultiSheet('exportDataAsExcel', params)) {\n this.excelCreator.exportDataAsExcel(params);\n }\n }\n /** This is method to be used to get the grid's data as a sheet, that will later be exported either by `getMultipleSheetsAsExcel()` or `exportMultipleSheetsAsExcel()`. */\n getSheetDataForExcel(params) {\n if (!ModuleRegistry.__assertRegistered(ModuleNames.ExcelExportModule, 'api.getSheetDataForExcel', this.context.getGridId())) {\n return;\n }\n const exportMode = this.getExcelExportMode(params);\n this.excelCreator.setFactoryMode(ExcelFactoryMode.MULTI_SHEET, exportMode);\n return this.excelCreator.getSheetDataForExcel(params);\n }\n /** Similar to `exportMultipleSheetsAsExcel`, except instead of downloading a file, it will return a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) to be processed by the user. */\n getMultipleSheetsAsExcel(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.ExcelExportModule, 'api.getMultipleSheetsAsExcel', this.context.getGridId())) {\n return this.excelCreator.getMultipleSheetsAsExcel(params);\n }\n }\n /** Downloads an Excel export of multiple sheets in one file. */\n exportMultipleSheetsAsExcel(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.ExcelExportModule, 'api.exportMultipleSheetsAsExcel', this.context.getGridId())) {\n return this.excelCreator.exportMultipleSheetsAsExcel(params);\n }\n }\n /**\n * Sets an ARIA property in the grid panel (element with `role=\\\"grid\\\"`), and removes an ARIA property when the value is null.\n *\n * Example: `api.setGridAriaProperty('label', 'my grid')` will set `aria-label=\\\"my grid\\\"`.\n *\n * `api.setGridAriaProperty('label', null)` will remove the `aria-label` attribute from the grid element.\n */\n setGridAriaProperty(property, value) {\n if (!property) {\n return;\n }\n const eGrid = this.ctrlsService.getGridBodyCtrl().getGui();\n const ariaProperty = `aria-${property}`;\n if (value === null) {\n eGrid.removeAttribute(ariaProperty);\n }\n else {\n eGrid.setAttribute(ariaProperty, value);\n }\n }\n logMissingRowModel(apiMethod, ...requiredRowModels) {\n console.error(`AG Grid: api.${apiMethod} can only be called when gridOptions.rowModelType is ${requiredRowModels.join(' or ')}`);\n }\n /** Set new datasource for Server-Side Row Model. */\n setServerSideDatasource(datasource) {\n if (this.serverSideRowModel) {\n this.serverSideRowModel.setDatasource(datasource);\n }\n else {\n this.logMissingRowModel('setServerSideDatasource', 'serverSide');\n }\n }\n /**\n * Updates the `cacheBlockSize` when requesting data from the server if `suppressServerSideInfiniteScroll` is not enabled.\n *\n * Note this purges all the cached data and reloads all the rows of the grid.\n * */\n setCacheBlockSize(blockSize) {\n if (this.serverSideRowModel) {\n this.gos.set('cacheBlockSize', blockSize);\n this.serverSideRowModel.resetRootStore();\n }\n else {\n this.logMissingRowModel('setCacheBlockSize', 'serverSide');\n }\n }\n /** Set new datasource for Infinite Row Model. */\n setDatasource(datasource) {\n if (this.gos.isRowModelType('infinite')) {\n this.rowModel.setDatasource(datasource);\n }\n else {\n this.logMissingRowModel('setDatasource', 'infinite');\n }\n }\n /** Set new datasource for Viewport Row Model. */\n setViewportDatasource(viewportDatasource) {\n if (this.gos.isRowModelType('viewport')) {\n // this is bad coding, because it's using an interface that's exposed in the enterprise.\n // really we should create an interface in the core for viewportDatasource and let\n // the enterprise implement it, rather than casting to 'any' here\n this.rowModel.setViewportDatasource(viewportDatasource);\n }\n else {\n this.logMissingRowModel('setViewportDatasource', 'viewport');\n }\n }\n /** Set the row data. */\n setRowData(rowData) {\n // immutable service is part of the CSRM module, if missing, no CSRM\n const missingImmutableService = this.immutableService == null;\n if (missingImmutableService) {\n this.logMissingRowModel('setRowData', 'clientSide');\n return;\n }\n // if no keys provided provided for rows, then we can tread the operation as Immutable\n if (this.immutableService.isActive()) {\n this.immutableService.setRowData(rowData);\n }\n else {\n this.selectionService.reset();\n this.clientSideRowModel.setRowData(rowData);\n }\n }\n /** Set the top pinned rows. Call with no rows / undefined to clear top pinned rows. */\n setPinnedTopRowData(rows) {\n this.pinnedRowModel.setPinnedTopRowData(rows);\n }\n /** Set the bottom pinned rows. Call with no rows / undefined to clear bottom pinned rows. */\n setPinnedBottomRowData(rows) {\n this.pinnedRowModel.setPinnedBottomRowData(rows);\n }\n /** Gets the number of top pinned rows. */\n getPinnedTopRowCount() {\n return this.pinnedRowModel.getPinnedTopRowCount();\n }\n /** Gets the number of bottom pinned rows. */\n getPinnedBottomRowCount() {\n return this.pinnedRowModel.getPinnedBottomRowCount();\n }\n /** Gets the top pinned row with the specified index. */\n getPinnedTopRow(index) {\n return this.pinnedRowModel.getPinnedTopRow(index);\n }\n /** Gets the bottom pinned row with the specified index. */\n getPinnedBottomRow(index) {\n return this.pinnedRowModel.getPinnedBottomRow(index);\n }\n /**\n * Call to set new column definitions. The grid will redraw all the column headers, and then redraw all of the rows.\n */\n setColumnDefs(colDefs, source = \"api\") {\n this.columnModel.setColumnDefs(colDefs, source);\n // Keep gridOptions.columnDefs in sync\n this.gos.set('columnDefs', colDefs, true, { source });\n }\n /** Call to set new auto group column definition. The grid will recreate any auto-group columns if present. */\n setAutoGroupColumnDef(colDef, source = \"api\") {\n this.gos.set('autoGroupColumnDef', colDef, true, { source });\n }\n /** Call to set new Default Column Definition. */\n setDefaultColDef(colDef, source = \"api\") {\n this.gos.set('defaultColDef', colDef, true, { source });\n }\n /** Call to set new Column Types. */\n setColumnTypes(columnTypes, source = \"api\") {\n this.gos.set('columnTypes', columnTypes, true, { source });\n }\n expireValueCache() {\n this.valueCache.expire();\n }\n /**\n * Returns an object with two properties:\n * - `top`: The top pixel position of the current scroll in the grid\n * - `bottom`: The bottom pixel position of the current scroll in the grid\n */\n getVerticalPixelRange() {\n return this.gridBodyCtrl.getScrollFeature().getVScrollPosition();\n }\n /**\n * Returns an object with two properties:\n * - `left`: The left pixel position of the current scroll in the grid\n * - `right`: The right pixel position of the current scroll in the grid\n */\n getHorizontalPixelRange() {\n return this.gridBodyCtrl.getScrollFeature().getHScrollPosition();\n }\n /** If `true`, the horizontal scrollbar will always be present, even if not required. Otherwise, it will only be displayed when necessary. */\n setAlwaysShowHorizontalScroll(show) {\n this.gos.set('alwaysShowHorizontalScroll', show);\n }\n /** If `true`, the vertical scrollbar will always be present, even if not required. Otherwise it will only be displayed when necessary. */\n setAlwaysShowVerticalScroll(show) {\n this.gos.set('alwaysShowVerticalScroll', show);\n }\n /** Performs change detection on all cells, refreshing cells where required. */\n refreshCells(params = {}) {\n this.rowRenderer.refreshCells(params);\n }\n /** Flash rows, columns or individual cells. */\n flashCells(params = {}) {\n this.rowRenderer.flashCells(params);\n }\n /** Remove row(s) from the DOM and recreate them again from scratch. */\n redrawRows(params = {}) {\n const rowNodes = params ? params.rowNodes : undefined;\n this.rowRenderer.redrawRows(rowNodes);\n }\n setFunctionsReadOnly(readOnly) {\n this.gos.set('functionsReadOnly', readOnly);\n }\n /** Redraws the header. Useful if a column name changes, or something else that changes how the column header is displayed. */\n refreshHeader() {\n this.ctrlsService.getHeaderRowContainerCtrls().forEach(c => c.refresh());\n }\n /** Returns `true` if any filter is set. This includes quick filter, column filter, external filter or advanced filter. */\n isAnyFilterPresent() {\n return this.filterManager.isAnyFilterPresent();\n }\n /** Returns `true` if any column filter is set, otherwise `false`. */\n isColumnFilterPresent() {\n return this.filterManager.isColumnFilterPresent() || this.filterManager.isAggregateFilterPresent();\n }\n /** Returns `true` if the Quick Filter is set, otherwise `false`. */\n isQuickFilterPresent() {\n return this.filterManager.isQuickFilterPresent();\n }\n /**\n * Returns the row model inside the table.\n * From here you can see the original rows, rows after filter has been applied,\n * rows after aggregation has been applied, and the final set of 'to be displayed' rows.\n */\n getModel() {\n return this.rowModel;\n }\n /** Expand or collapse a specific row node, optionally expanding/collapsing all of its parent nodes. */\n setRowNodeExpanded(rowNode, expanded, expandParents) {\n if (rowNode) {\n // expand all parents recursively, except root node.\n if (expandParents && rowNode.parent && rowNode.parent.level !== -1) {\n this.setRowNodeExpanded(rowNode.parent, expanded, expandParents);\n }\n rowNode.setExpanded(expanded);\n }\n }\n /**\n * Informs the grid that row group expanded state has changed and it needs to rerender the group nodes.\n * Typically called after updating the row node expanded state explicitly, i.e `rowNode.expanded = false`,\n * across multiple groups and you want to update the grid view in a single rerender instead of on every group change.\n */\n onGroupExpandedOrCollapsed() {\n if (missing(this.clientSideRowModel)) {\n this.logMissingRowModel('onGroupExpandedOrCollapsed', 'clientSide');\n return;\n }\n // we don't really want the user calling this if only one rowNode was expanded, instead they should be\n // calling rowNode.setExpanded(boolean) - this way we do a 'keepRenderedRows=false' so that the whole\n // grid gets refreshed again - otherwise the row with the rowNodes that were changed won't get updated,\n // and thus the expand icon in the group cell won't get 'opened' or 'closed'.\n this.clientSideRowModel.refreshModel({ step: ClientSideRowModelSteps.MAP });\n }\n /**\n * Refresh the Client-Side Row Model, executing the grouping, filtering and sorting again.\n * Optionally provide the step you wish the refresh to apply from. Defaults to `everything`.\n */\n refreshClientSideRowModel(step) {\n if (missing(this.clientSideRowModel)) {\n this.logMissingRowModel('refreshClientSideRowModel', 'clientSide');\n return;\n }\n this.clientSideRowModel.refreshModel(step);\n }\n /** Returns `true` when there are no more animation frames left to process. */\n isAnimationFrameQueueEmpty() {\n return this.animationFrameService.isQueueEmpty();\n }\n flushAllAnimationFrames() {\n this.animationFrameService.flushAllFrames();\n }\n /**\n * Returns the row node with the given ID.\n * The row node ID is the one you provide from the callback `getRowId(params)`,\n * otherwise the ID is a number (cast as string) auto-generated by the grid when\n * the row data is set.\n */\n getRowNode(id) {\n return this.rowModel.getRowNode(id);\n }\n /**\n * Gets the sizes that various UI elements will be rendered at with the current theme.\n * If you override the row or header height using `gridOptions`, the override value you provided will be returned.\n */\n getSizesForCurrentTheme() {\n return {\n rowHeight: this.gos.getRowHeightAsNumber(),\n headerHeight: this.columnModel.getHeaderHeight()\n };\n }\n /** Expand all groups. */\n expandAll() {\n if (this.clientSideRowModel) {\n this.clientSideRowModel.expandOrCollapseAll(true);\n }\n else if (this.serverSideRowModel) {\n this.serverSideRowModel.expandAll(true);\n }\n else {\n this.logMissingRowModel('expandAll', 'clientSide', 'serverSide');\n }\n }\n /** Collapse all groups. */\n collapseAll() {\n if (this.clientSideRowModel) {\n this.clientSideRowModel.expandOrCollapseAll(false);\n }\n else if (this.serverSideRowModel) {\n this.serverSideRowModel.expandAll(false);\n }\n else {\n this.logMissingRowModel('expandAll', 'clientSide', 'serverSide');\n }\n }\n /**\n * Registers a callback to a virtual row.\n * A virtual row is a row that is visually rendered on the screen (rows that are not visible because of the scroll position are not rendered).\n * Unlike normal events, you do not need to unregister rendered row listeners.\n * When the rendered row is removed from the grid, all associated rendered row listeners will also be removed.\n * listen for this event if your `cellRenderer` needs to do cleanup when the row no longer exists.\n */\n addRenderedRowListener(eventName, rowIndex, callback) {\n this.rowRenderer.addRenderedRowListener(eventName, rowIndex, callback);\n }\n /** Get the current Quick Filter text from the grid, or `undefined` if none is set. */\n getQuickFilter() {\n return this.gos.get('quickFilterText');\n }\n /** Pass a Quick Filter text into the grid for filtering. */\n setQuickFilter(newFilter) {\n this.gos.set('quickFilterText', newFilter);\n }\n /**\n * @deprecated As of v30, hidden columns are excluded from the Quick Filter by default. To include hidden columns, use `setIncludeHiddenColumnsInQuickFilter` instead.\n */\n setExcludeHiddenColumnsFromQuickFilter(value) {\n logDeprecation('30', 'setExcludeHiddenColumnsFromQuickFilter', undefined, 'Hidden columns are now excluded from the Quick Filter by default. This can be toggled using `setIncludeHiddenColumnsInQuickFilter`');\n this.setIncludeHiddenColumnsInQuickFilter(!value);\n }\n /**\n * Updates the `includeHiddenColumnsInQuickFilter` grid option.\n * By default hidden columns are excluded from the Quick Filter.\n * Set to `true` to include them.\n */\n setIncludeHiddenColumnsInQuickFilter(value) {\n this.gos.set('includeHiddenColumnsInQuickFilter', value);\n }\n /** Get the state of the Advanced Filter. Used for saving Advanced Filter state */\n getAdvancedFilterModel() {\n if (ModuleRegistry.__assertRegistered(ModuleNames.AdvancedFilterModule, 'api.getAdvancedFilterModel', this.context.getGridId())) {\n return this.filterManager.getAdvancedFilterModel();\n }\n return null;\n }\n /** Set the state of the Advanced Filter. Used for restoring Advanced Filter state */\n setAdvancedFilterModel(advancedFilterModel) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.AdvancedFilterModule, 'api.setAdvancedFilterModel', this.context.getGridId())) {\n this.filterManager.setAdvancedFilterModel(advancedFilterModel);\n }\n }\n /** Enable/disable the Advanced Filter */\n setEnableAdvancedFilter(enabled) {\n this.gos.set('enableAdvancedFilter', enabled);\n }\n /**\n * Updates the `includeHiddenColumnsInAdvancedFilter` grid option.\n * By default hidden columns are excluded from the Advanced Filter.\n * Set to `true` to include them.\n */\n setIncludeHiddenColumnsInAdvancedFilter(value) {\n this.gos.set('includeHiddenColumnsInAdvancedFilter', value);\n }\n /**\n * DOM element to use as the parent for the Advanced Filter, to allow it to appear outside of the grid.\n * Set to `null` to appear inside the grid.\n */\n setAdvancedFilterParent(advancedFilterParent) {\n this.gos.set('advancedFilterParent', advancedFilterParent);\n }\n /**\n * Set all of the provided nodes selection state to the provided value.\n */\n setNodesSelected(params) {\n const allNodesValid = params.nodes.every(node => {\n if (node.rowPinned) {\n console.warn('AG Grid: cannot select pinned rows');\n return false;\n }\n if (node.id === undefined) {\n console.warn('AG Grid: cannot select node until id for node is known');\n return false;\n }\n return true;\n });\n if (!allNodesValid) {\n return;\n }\n const { nodes, source, newValue } = params;\n const nodesAsRowNode = nodes;\n this.selectionService.setNodesSelected({ nodes: nodesAsRowNode, source: source !== null && source !== void 0 ? source : 'api', newValue });\n }\n /**\n * Select all rows, regardless of filtering and rows that are not visible due to grouping being enabled and their groups not expanded.\n * @param source Source property that will appear in the `selectionChanged` event, defaults to `'apiSelectAll'`\n */\n selectAll(source = 'apiSelectAll') {\n this.selectionService.selectAllRowNodes({ source });\n }\n /**\n * Clear all row selections, regardless of filtering.\n * @param source Source property that will appear in the `selectionChanged` event, defaults to `'apiSelectAll'`\n */\n deselectAll(source = 'apiSelectAll') {\n this.selectionService.deselectAllRowNodes({ source });\n }\n /**\n * Select all filtered rows.\n * @param source Source property that will appear in the `selectionChanged` event, defaults to `'apiSelectAllFiltered'`\n */\n selectAllFiltered(source = 'apiSelectAllFiltered') {\n this.selectionService.selectAllRowNodes({ source, justFiltered: true });\n }\n /**\n * Clear all filtered selections.\n * @param source Source property that will appear in the `selectionChanged` event, defaults to `'apiSelectAllFiltered'`\n */\n deselectAllFiltered(source = 'apiSelectAllFiltered') {\n this.selectionService.deselectAllRowNodes({ source, justFiltered: true });\n }\n /**\n * Returns an object containing rules matching the selected rows in the SSRM.\n *\n * If `groupSelectsChildren=false` the returned object will be flat, and will conform to IServerSideSelectionState.\n * If `groupSelectsChildren=true` the retuned object will be hierarchical, and will conform to IServerSideGroupSelectionState.\n */\n getServerSideSelectionState() {\n if (missing(this.serverSideRowModel)) {\n this.logMissingRowModel('getServerSideSelectionState', 'serverSide');\n return null;\n }\n return this.selectionService.getServerSideSelectionState();\n }\n /**\n * Set the rules matching the selected rows in the SSRM.\n *\n * If `groupSelectsChildren=false` the param will be flat, and should conform to IServerSideSelectionState.\n * If `groupSelectsChildren=true` the param will be hierarchical, and should conform to IServerSideGroupSelectionState.\n */\n setServerSideSelectionState(state) {\n if (missing(this.serverSideRowModel)) {\n this.logMissingRowModel('setServerSideSelectionState', 'serverSide');\n return;\n }\n this.selectionService.setServerSideSelectionState(state);\n }\n /**\n * Select all rows on the current page.\n * @param source Source property that will appear in the `selectionChanged` event, defaults to `'apiSelectAllCurrentPage'`\n */\n selectAllOnCurrentPage(source = 'apiSelectAllCurrentPage') {\n this.selectionService.selectAllRowNodes({ source, justCurrentPage: true });\n }\n /**\n * Clear all filtered on the current page.\n * @param source Source property that will appear in the `selectionChanged` event, defaults to `'apiSelectAllCurrentPage'`\n */\n deselectAllOnCurrentPage(source = 'apiSelectAllCurrentPage') {\n this.selectionService.deselectAllRowNodes({ source, justCurrentPage: true });\n }\n /**\n * Sets columns to adjust in size to fit the grid horizontally. If inferring cell data types with custom column types\n * and row data is provided asynchronously, the column sizing will happen asynchronously when row data is added.\n * To always perform this synchronously, set `cellDataType = false` on the default column definition.\n **/\n sizeColumnsToFit(params) {\n this.gridBodyCtrl.sizeColumnsToFit(params);\n }\n /** Show the 'loading' overlay. */\n showLoadingOverlay() {\n this.overlayWrapperComp.showLoadingOverlay();\n }\n /** Show the 'no rows' overlay. */\n showNoRowsOverlay() {\n this.overlayWrapperComp.showNoRowsOverlay();\n }\n /** Hides the overlay if showing. */\n hideOverlay() {\n this.overlayWrapperComp.hideOverlay();\n }\n /**\n * Returns an unsorted list of selected nodes.\n * Getting the underlying node (rather than the data) is useful when working with tree / aggregated data,\n * as the node can be traversed.\n */\n getSelectedNodes() {\n return this.selectionService.getSelectedNodes();\n }\n /** Returns an unsorted list of selected rows (i.e. row data that you provided). */\n getSelectedRows() {\n return this.selectionService.getSelectedRows();\n }\n /**\n * Returns a list of all selected nodes at 'best cost', a feature to be used with groups / trees.\n * If a group has all its children selected, then the group appears in the result, but not the children.\n * Designed for use with `'children'` as the group selection type, where groups don't actually appear in the selection normally.\n */\n getBestCostNodeSelection() {\n if (missing(this.clientSideRowModel)) {\n this.logMissingRowModel('getBestCostNodeSelection', 'clientSide');\n return;\n }\n return this.selectionService.getBestCostNodeSelection();\n }\n /** Retrieve rendered nodes. Due to virtualisation this will contain only the current visible rows and those in the buffer. */\n getRenderedNodes() {\n return this.rowRenderer.getRenderedNodes();\n }\n /**\n * Ensures the column is visible by scrolling the table if needed.\n *\n * This will have no effect before the firstDataRendered event has fired.\n *\n * @param key - The column to ensure visible\n * @param position - Where the column will be positioned.\n * - `auto` - Scrolls the minimum amount to make sure the column is visible.\n * - `start` - Scrolls the column to the start of the viewport.\n * - `middle` - Scrolls the column to the middle of the viewport.\n * - `end` - Scrolls the column to the end of the viewport.\n */\n ensureColumnVisible(key, position = 'auto') {\n this.gridBodyCtrl.getScrollFeature().ensureColumnVisible(key, position);\n }\n /**\n * Vertically scrolls the grid until the provided row index is inside the visible viewport.\n * If a position is provided, the grid will attempt to scroll until the row is at the given position within the viewport.\n * This will have no effect before the firstDataRendered event has fired.\n */\n ensureIndexVisible(index, position) {\n this.gridBodyCtrl.getScrollFeature().ensureIndexVisible(index, position);\n }\n /**\n * Vertically scrolls the grid until the provided row (or a row matching the provided comparator) is inside the visible viewport.\n * If a position is provided, the grid will attempt to scroll until the row is at the given position within the viewport.\n * This will have no effect before the firstDataRendered event has fired.\n */\n ensureNodeVisible(nodeSelector, position = null) {\n this.gridBodyCtrl.getScrollFeature().ensureNodeVisible(nodeSelector, position);\n }\n /**\n * Similar to `forEachNode`, except lists all the leaf nodes.\n * This effectively goes through all the data that you provided to the grid before the grid performed any grouping.\n * If using tree data, goes through all the nodes for the data you provided, including nodes that have children,\n * but excluding groups the grid created where gaps were missing in the hierarchy.\n */\n forEachLeafNode(callback) {\n if (missing(this.clientSideRowModel)) {\n this.logMissingRowModel('forEachLeafNode', 'clientSide');\n return;\n }\n this.clientSideRowModel.forEachLeafNode(callback);\n }\n /**\n * Iterates through each node (row) in the grid and calls the callback for each node.\n * This works similar to the `forEach` method on a JavaScript array.\n * This is called for every node, ignoring any filtering or sorting applied within the grid.\n * If using the Infinite Row Model, then this gets called for each page loaded in the page cache.\n */\n forEachNode(callback, includeFooterNodes) {\n this.rowModel.forEachNode(callback, includeFooterNodes);\n }\n /** Similar to `forEachNode`, except skips any filtered out data. */\n forEachNodeAfterFilter(callback) {\n if (missing(this.clientSideRowModel)) {\n this.logMissingRowModel('forEachNodeAfterFilter', 'clientSide');\n return;\n }\n this.clientSideRowModel.forEachNodeAfterFilter(callback);\n }\n /** Similar to `forEachNodeAfterFilter`, except the callbacks are called in the order the rows are displayed in the grid. */\n forEachNodeAfterFilterAndSort(callback) {\n if (missing(this.clientSideRowModel)) {\n this.logMissingRowModel('forEachNodeAfterFilterAndSort', 'clientSide');\n return;\n }\n this.clientSideRowModel.forEachNodeAfterFilterAndSort(callback);\n }\n /**\n * Returns the filter component instance for a column.\n * `key` can be a string field name or a ColDef object (matches on object reference, useful if field names are not unique).\n * If your filter is created asynchronously, `getFilterInstance` will return `null` so you will need to use the `callback` to access the filter instance instead.\n */\n getFilterInstance(key, callback) {\n return this.filterManager.getFilterInstance(key, callback);\n }\n /** Destroys a filter. Useful to force a particular filter to be created from scratch again. */\n destroyFilter(key) {\n const column = this.columnModel.getPrimaryColumn(key);\n if (column) {\n return this.filterManager.destroyFilter(column, 'api');\n }\n }\n /** Gets the status panel instance corresponding to the supplied `id`. */\n getStatusPanel(key) {\n if (!ModuleRegistry.__assertRegistered(ModuleNames.StatusBarModule, 'api.getStatusPanel', this.context.getGridId())) {\n return;\n }\n const comp = this.statusBarService.getStatusPanel(key);\n return unwrapUserComp(comp);\n }\n getColumnDef(key) {\n const column = this.columnModel.getPrimaryColumn(key);\n if (column) {\n return column.getColDef();\n }\n return null;\n }\n /**\n * Returns the current column definitions.\n */\n getColumnDefs() { return this.columnModel.getColumnDefs(); }\n /**\n * Informs the grid that a filter has changed. This is typically called after a filter change through one of the filter APIs.\n * @param source The source of the filter change event. If not specified defaults to `'api'`.\n */\n onFilterChanged(source = 'api') {\n this.filterManager.onFilterChanged({ source });\n }\n /**\n * Gets the grid to act as if the sort was changed.\n * Useful if you update some values and want to get the grid to reorder them according to the new values.\n */\n onSortChanged() {\n this.sortController.onSortChanged('api');\n }\n /**\n * Sets the state of all the column filters. Provide it with what you get from `getFilterModel()` to restore filter state.\n * If inferring cell data types, and row data is provided asynchronously and is yet to be set,\n * the filter model will be applied asynchronously after row data is added.\n * To always perform this synchronously, set `cellDataType = false` on the default column definition,\n * or provide cell data types for every column.\n */\n setFilterModel(model) {\n this.filterManager.setFilterModel(model);\n }\n /** Gets the current state of all the column filters. Used for saving filter state. */\n getFilterModel() {\n return this.filterManager.getFilterModel();\n }\n /** Returns the focused cell (or the last focused cell if the grid lost focus). */\n getFocusedCell() {\n return this.focusService.getFocusedCell();\n }\n /** Clears the focused cell. */\n clearFocusedCell() {\n return this.focusService.clearFocusedCell();\n }\n /** Sets the focus to the specified cell. `rowPinned` can be either 'top', 'bottom' or null (for not pinned). */\n setFocusedCell(rowIndex, colKey, rowPinned) {\n this.focusService.setFocusedCell({ rowIndex, column: colKey, rowPinned, forceBrowserFocus: true });\n }\n /** Sets the `suppressRowDrag` property. */\n setSuppressRowDrag(value) {\n this.gos.set('suppressRowDrag', value);\n }\n /** Sets the `suppressMoveWhenRowDragging` property. */\n setSuppressMoveWhenRowDragging(value) {\n this.gos.set('suppressMoveWhenRowDragging', value);\n }\n /** Sets the `suppressRowClickSelection` property. */\n setSuppressRowClickSelection(value) {\n this.gos.set('suppressRowClickSelection', value);\n }\n /** Adds a drop zone outside of the grid where rows can be dropped. */\n addRowDropZone(params) {\n this.gridBodyCtrl.getRowDragFeature().addRowDropZone(params);\n }\n /** Removes an external drop zone added by `addRowDropZone`. */\n removeRowDropZone(params) {\n const activeDropTarget = this.dragAndDropService.findExternalZone(params);\n if (activeDropTarget) {\n this.dragAndDropService.removeDropTarget(activeDropTarget);\n }\n }\n /** Returns the `RowDropZoneParams` to be used by another grid's `addRowDropZone` method. */\n getRowDropZoneParams(events) {\n return this.gridBodyCtrl.getRowDragFeature().getRowDropZone(events);\n }\n /** Sets the height in pixels for the row containing the column label header. */\n setHeaderHeight(headerHeight) {\n this.gos.set('headerHeight', headerHeight);\n }\n /**\n * Switch between layout options: `normal`, `autoHeight`, `print`.\n * Defaults to `normal` if no domLayout provided.\n */\n setDomLayout(domLayout) {\n this.gos.set('domLayout', domLayout);\n }\n /** Sets the `enableCellTextSelection` property. */\n setEnableCellTextSelection(selectable) {\n this.gridBodyCtrl.setCellTextSelection(selectable);\n }\n /** Sets the preferred direction for the selection fill handle. */\n setFillHandleDirection(direction) {\n this.gos.set('fillHandleDirection', direction);\n }\n /** Sets the height in pixels for the rows containing header column groups. */\n setGroupHeaderHeight(headerHeight) {\n this.gos.set('groupHeaderHeight', headerHeight);\n }\n /** Sets the height in pixels for the row containing the floating filters. */\n setFloatingFiltersHeight(headerHeight) {\n this.gos.set('floatingFiltersHeight', headerHeight);\n }\n /** Sets the height in pixels for the row containing the columns when in pivot mode. */\n setPivotHeaderHeight(headerHeight) {\n this.gos.set('pivotHeaderHeight', headerHeight);\n }\n /** Sets the height in pixels for the row containing header column groups when in pivot mode. */\n setPivotGroupHeaderHeight(headerHeight) {\n this.gos.set('pivotGroupHeaderHeight', headerHeight);\n }\n setPivotMode(pivotMode) {\n this.columnModel.setPivotMode(pivotMode);\n }\n setAnimateRows(animateRows) {\n this.gos.set('animateRows', animateRows);\n }\n setIsExternalFilterPresent(isExternalFilterPresentFunc) {\n this.gos.set('isExternalFilterPresent', isExternalFilterPresentFunc);\n }\n setDoesExternalFilterPass(doesExternalFilterPassFunc) {\n this.gos.set('doesExternalFilterPass', doesExternalFilterPassFunc);\n }\n setNavigateToNextCell(navigateToNextCellFunc) {\n this.gos.set('navigateToNextCell', navigateToNextCellFunc);\n }\n setTabToNextCell(tabToNextCellFunc) {\n this.gos.set('tabToNextCell', tabToNextCellFunc);\n }\n setTabToNextHeader(tabToNextHeaderFunc) {\n this.gos.set('tabToNextHeader', tabToNextHeaderFunc);\n }\n setNavigateToNextHeader(navigateToNextHeaderFunc) {\n this.gos.set('navigateToNextHeader', navigateToNextHeaderFunc);\n }\n setRowGroupPanelShow(rowGroupPanelShow) {\n this.gos.set('rowGroupPanelShow', rowGroupPanelShow);\n }\n setGetGroupRowAgg(getGroupRowAggFunc) {\n this.gos.set('getGroupRowAgg', getGroupRowAggFunc);\n }\n setGetBusinessKeyForNode(getBusinessKeyForNodeFunc) {\n this.gos.set('getBusinessKeyForNode', getBusinessKeyForNodeFunc);\n }\n setGetChildCount(getChildCountFunc) {\n this.gos.set('getChildCount', getChildCountFunc);\n }\n setProcessRowPostCreate(processRowPostCreateFunc) {\n this.gos.set('processRowPostCreate', processRowPostCreateFunc);\n }\n setGetRowId(getRowIdFunc) {\n this.gos.set('getRowId', getRowIdFunc);\n }\n setGetRowClass(rowClassFunc) {\n this.gos.set('getRowClass', rowClassFunc);\n }\n setIsFullWidthRow(isFullWidthRowFunc) {\n this.gos.set('isFullWidthRow', isFullWidthRowFunc);\n }\n setIsRowSelectable(isRowSelectableFunc) {\n this.gos.set('isRowSelectable', isRowSelectableFunc);\n }\n setIsRowMaster(isRowMasterFunc) {\n this.gos.set('isRowMaster', isRowMasterFunc);\n }\n setPostSortRows(postSortRowsFunc) {\n this.gos.set('postSortRows', postSortRowsFunc);\n }\n setGetDocument(getDocumentFunc) {\n this.gos.set('getDocument', getDocumentFunc);\n }\n setGetContextMenuItems(getContextMenuItemsFunc) {\n this.gos.set('getContextMenuItems', getContextMenuItemsFunc);\n }\n setGetMainMenuItems(getMainMenuItemsFunc) {\n this.gos.set('getMainMenuItems', getMainMenuItemsFunc);\n }\n setProcessCellForClipboard(processCellForClipboardFunc) {\n this.gos.set('processCellForClipboard', processCellForClipboardFunc);\n }\n setSendToClipboard(sendToClipboardFunc) {\n this.gos.set('sendToClipboard', sendToClipboardFunc);\n }\n setProcessCellFromClipboard(processCellFromClipboardFunc) {\n this.gos.set('processCellFromClipboard', processCellFromClipboardFunc);\n }\n /** @deprecated v28 use `setProcessPivotResultColDef` instead */\n setProcessSecondaryColDef(processSecondaryColDefFunc) {\n logDeprecation('28.0', 'setProcessSecondaryColDef', 'setProcessPivotResultColDef');\n this.setProcessPivotResultColDef(processSecondaryColDefFunc);\n }\n /** @deprecated v28 use `setProcessPivotResultColGroupDef` instead */\n setProcessSecondaryColGroupDef(processSecondaryColGroupDefFunc) {\n logDeprecation('28.0', 'setProcessSecondaryColGroupDef', 'setProcessPivotResultColGroupDef');\n this.setProcessPivotResultColGroupDef(processSecondaryColGroupDefFunc);\n }\n setProcessPivotResultColDef(processPivotResultColDefFunc) {\n this.gos.set('processPivotResultColDef', processPivotResultColDefFunc);\n }\n setProcessPivotResultColGroupDef(processPivotResultColGroupDefFunc) {\n this.gos.set('processPivotResultColGroupDef', processPivotResultColGroupDefFunc);\n }\n setPostProcessPopup(postProcessPopupFunc) {\n this.gos.set('postProcessPopup', postProcessPopupFunc);\n }\n setInitialGroupOrderComparator(initialGroupOrderComparatorFunc) {\n this.gos.set('initialGroupOrderComparator', initialGroupOrderComparatorFunc);\n }\n setGetChartToolbarItems(getChartToolbarItemsFunc) {\n this.gos.set('getChartToolbarItems', getChartToolbarItemsFunc);\n }\n setPaginationNumberFormatter(paginationNumberFormatterFunc) {\n this.gos.set('paginationNumberFormatter', paginationNumberFormatterFunc);\n }\n /** @deprecated v28 use setGetServerSideGroupLevelParams instead */\n setGetServerSideStoreParams(getServerSideStoreParamsFunc) {\n logDeprecation('28.0', 'setGetServerSideStoreParams', 'setGetServerSideGroupLevelParams');\n this.setGetServerSideGroupLevelParams(getServerSideStoreParamsFunc);\n }\n setGetServerSideGroupLevelParams(getServerSideGroupLevelParamsFunc) {\n this.gos.set('getServerSideGroupLevelParams', getServerSideGroupLevelParamsFunc);\n }\n setIsServerSideGroupOpenByDefault(isServerSideGroupOpenByDefaultFunc) {\n this.gos.set('isServerSideGroupOpenByDefault', isServerSideGroupOpenByDefaultFunc);\n }\n setIsApplyServerSideTransaction(isApplyServerSideTransactionFunc) {\n this.gos.set('isApplyServerSideTransaction', isApplyServerSideTransactionFunc);\n }\n setIsServerSideGroup(isServerSideGroupFunc) {\n this.gos.set('isServerSideGroup', isServerSideGroupFunc);\n }\n setGetServerSideGroupKey(getServerSideGroupKeyFunc) {\n this.gos.set('getServerSideGroupKey', getServerSideGroupKeyFunc);\n }\n setGetRowStyle(rowStyleFunc) {\n this.gos.set('getRowStyle', rowStyleFunc);\n }\n setGetRowHeight(rowHeightFunc) {\n this.gos.set('getRowHeight', rowHeightFunc);\n }\n assertSideBarLoaded(apiMethod) {\n return ModuleRegistry.__assertRegistered(ModuleNames.SideBarModule, 'api.' + apiMethod, this.context.getGridId());\n }\n /** Returns `true` if the side bar is visible. */\n isSideBarVisible() {\n return this.assertSideBarLoaded('isSideBarVisible') && this.sideBarComp.isDisplayed();\n }\n /** Show/hide the entire side bar, including any visible panel and the tab buttons. */\n setSideBarVisible(show) {\n if (this.assertSideBarLoaded('setSideBarVisible')) {\n this.sideBarComp.setDisplayed(show);\n }\n }\n /** Sets the side bar position relative to the grid. Possible values are `'left'` or `'right'`. */\n setSideBarPosition(position) {\n if (this.assertSideBarLoaded('setSideBarPosition')) {\n this.sideBarComp.setSideBarPosition(position);\n }\n }\n /** Opens a particular tool panel. Provide the ID of the tool panel to open. */\n openToolPanel(key) {\n if (this.assertSideBarLoaded('openToolPanel')) {\n this.sideBarComp.openToolPanel(key, 'api');\n }\n }\n /** Closes the currently open tool panel (if any). */\n closeToolPanel() {\n if (this.assertSideBarLoaded('closeToolPanel')) {\n this.sideBarComp.close('api');\n }\n }\n /** Returns the ID of the currently shown tool panel if any, otherwise `null`. */\n getOpenedToolPanel() {\n if (this.assertSideBarLoaded('getOpenedToolPanel')) {\n return this.sideBarComp.openedItem();\n }\n return null;\n }\n /** Force refresh all tool panels by calling their `refresh` method. */\n refreshToolPanel() {\n if (this.assertSideBarLoaded('refreshToolPanel')) {\n this.sideBarComp.refresh();\n }\n }\n /** Returns `true` if the tool panel is showing, otherwise `false`. */\n isToolPanelShowing() {\n return this.assertSideBarLoaded('isToolPanelShowing') && this.sideBarComp.isToolPanelShowing();\n }\n /** Gets the tool panel instance corresponding to the supplied `id`. */\n getToolPanelInstance(id) {\n if (this.assertSideBarLoaded('getToolPanelInstance')) {\n const comp = this.sideBarComp.getToolPanelInstance(id);\n return unwrapUserComp(comp);\n }\n }\n /** Returns the current side bar configuration. If a shortcut was used, returns the detailed long form. */\n getSideBar() {\n if (this.assertSideBarLoaded('getSideBar')) {\n return this.sideBarComp.getDef();\n }\n return undefined;\n }\n /** Resets the side bar to the provided configuration. The parameter is the same as the sideBar grid property. The side bar is re-created from scratch with the new config. */\n setSideBar(def) {\n this.gos.set('sideBar', def);\n }\n setSuppressClipboardPaste(value) {\n this.gos.set('suppressClipboardPaste', value);\n }\n /** Tells the grid to recalculate the row heights. */\n resetRowHeights() {\n if (exists(this.clientSideRowModel)) {\n if (this.columnModel.isAutoRowHeightActive()) {\n console.warn('AG Grid: calling gridApi.resetRowHeights() makes no sense when using Auto Row Height.');\n return;\n }\n this.clientSideRowModel.resetRowHeights();\n }\n }\n setGroupRemoveSingleChildren(value) {\n this.gos.set('groupRemoveSingleChildren', value);\n }\n setGroupRemoveLowestSingleChildren(value) {\n this.gos.set('groupRemoveLowestSingleChildren', value);\n }\n setGroupDisplayType(value) {\n this.gos.set('groupDisplayType', value);\n }\n setRowClass(className) {\n this.gos.set('rowClass', className);\n }\n /** Sets the `deltaSort` property */\n setDeltaSort(enable) {\n this.gos.set('deltaSort', enable);\n }\n /**\n * Sets the `rowCount` and `maxRowFound` properties.\n * The second parameter, `maxRowFound`, is optional and if left out, only `rowCount` is set.\n * Set `rowCount` to adjust the height of the vertical scroll.\n * Set `maxRowFound` to enable / disable searching for more rows.\n * Use this method if you add or remove rows into the dataset and need to reset the number of rows or instruct the grid that the entire row count is no longer known.\n */\n setRowCount(rowCount, maxRowFound) {\n if (this.serverSideRowModel) {\n if (this.columnModel.isRowGroupEmpty()) {\n this.serverSideRowModel.setRowCount(rowCount, maxRowFound);\n return;\n }\n console.error('AG Grid: setRowCount cannot be used while using row grouping.');\n return;\n }\n if (this.infiniteRowModel) {\n this.infiniteRowModel.setRowCount(rowCount, maxRowFound);\n return;\n }\n this.logMissingRowModel('setRowCount', 'infinite', 'serverSide');\n }\n /** Tells the grid a row height has changed. To be used after calling `rowNode.setRowHeight(newHeight)`. */\n onRowHeightChanged() {\n if (this.clientSideRowModel) {\n this.clientSideRowModel.onRowHeightChanged();\n }\n else if (this.serverSideRowModel) {\n this.serverSideRowModel.onRowHeightChanged();\n }\n }\n /**\n * Gets the value for a column for a particular `rowNode` (row).\n * This is useful if you want the raw value of a cell e.g. if implementing your own CSV export.\n */\n getValue(colKey, rowNode) {\n let column = this.columnModel.getPrimaryColumn(colKey);\n if (missing(column)) {\n column = this.columnModel.getGridColumn(colKey);\n }\n if (missing(column)) {\n return null;\n }\n return this.valueService.getValue(column, rowNode);\n }\n /** Add an event listener for the specified `eventType`. Works similar to `addEventListener` for a browser DOM element. */\n addEventListener(eventType, listener) {\n const async = this.gos.useAsyncEvents();\n this.eventService.addEventListener(eventType, listener, async);\n }\n /** Add an event listener for all event types coming from the grid. */\n addGlobalListener(listener) {\n const async = this.gos.useAsyncEvents();\n this.eventService.addGlobalListener(listener, async);\n }\n /** Remove an event listener. */\n removeEventListener(eventType, listener) {\n const async = this.gos.useAsyncEvents();\n this.eventService.removeEventListener(eventType, listener, async);\n }\n /** Remove a global event listener. */\n removeGlobalListener(listener) {\n const async = this.gos.useAsyncEvents();\n this.eventService.removeGlobalListener(listener, async);\n }\n dispatchEvent(event) {\n this.eventService.dispatchEvent(event);\n }\n /** Will destroy the grid and release resources. If you are using a framework you do not need to call this, as the grid links in with the framework lifecycle. However if you are using Web Components or native JavaScript, you do need to call this, to avoid a memory leak in your application. */\n destroy() {\n // this is needed as GridAPI is a bean, and GridAPI.destroy() is called as part\n // of context.destroy(). so we need to stop the infinite loop.\n if (this.destroyCalled) {\n return;\n }\n this.destroyCalled = true;\n // destroy the UI first (as they use the services)\n const gridCtrl = this.ctrlsService.getGridCtrl();\n if (gridCtrl) {\n gridCtrl.destroyGridUi();\n }\n // destroy the services\n this.context.destroy();\n }\n cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid() {\n // some users were raising support issues with regards memory leaks. the problem was the customers applications\n // were keeping references to the API. trying to educate them all would be difficult, easier to just remove\n // all references in the API so at least the core grid can be garbage collected.\n //\n // wait about 100ms before clearing down the references, in case user has some cleanup to do,\n // and needs to deference the API first\n setTimeout(removeAllReferences.bind(window, this, 'Grid API'), 100);\n }\n warnIfDestroyed(methodName) {\n if (this.destroyCalled) {\n console.warn(`AG Grid: Grid API method ${methodName} was called on a grid that was destroyed.`);\n }\n return this.destroyCalled;\n }\n /** Reset the Quick Filter cache text on every rowNode. */\n resetQuickFilter() {\n if (this.warnIfDestroyed('resetQuickFilter')) {\n return;\n }\n this.filterManager.resetQuickFilterCache();\n }\n /** Returns the list of selected cell ranges. */\n getCellRanges() {\n if (this.rangeService) {\n return this.rangeService.getCellRanges();\n }\n ModuleRegistry.__assertRegistered(ModuleNames.RangeSelectionModule, 'api.getCellRanges', this.context.getGridId());\n return null;\n }\n /** Adds the provided cell range to the selected ranges. */\n addCellRange(params) {\n if (this.rangeService) {\n this.rangeService.addCellRange(params);\n return;\n }\n ModuleRegistry.__assertRegistered(ModuleNames.RangeSelectionModule, 'api.addCellRange', this.context.getGridId());\n }\n /** Clears the selected ranges. */\n clearRangeSelection() {\n if (this.rangeService) {\n this.rangeService.removeAllCellRanges();\n }\n ModuleRegistry.__assertRegistered(ModuleNames.RangeSelectionModule, 'gridApi.clearRangeSelection', this.context.getGridId());\n }\n /** Reverts the last cell edit. */\n undoCellEditing() {\n this.undoRedoService.undo('api');\n }\n /** Re-applies the most recently undone cell edit. */\n redoCellEditing() {\n this.undoRedoService.redo('api');\n }\n /** Returns current number of available cell edit undo operations. */\n getCurrentUndoSize() {\n return this.undoRedoService.getCurrentUndoStackSize();\n }\n /** Returns current number of available cell edit redo operations. */\n getCurrentRedoSize() {\n return this.undoRedoService.getCurrentRedoStackSize();\n }\n /** Returns a list of models with information about the charts that are currently rendered from the grid. */\n getChartModels() {\n if (ModuleRegistry.__assertRegistered(ModuleNames.GridChartsModule, 'api.getChartModels', this.context.getGridId())) {\n return this.chartService.getChartModels();\n }\n }\n /** Returns the `ChartRef` using the supplied `chartId`. */\n getChartRef(chartId) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.GridChartsModule, 'api.getChartRef', this.context.getGridId())) {\n return this.chartService.getChartRef(chartId);\n }\n }\n /** Returns a base64-encoded image data URL for the referenced chartId. */\n getChartImageDataURL(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.GridChartsModule, 'api.getChartImageDataURL', this.context.getGridId())) {\n return this.chartService.getChartImageDataURL(params);\n }\n }\n /** Starts a browser-based image download for the referenced chartId. */\n downloadChart(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.GridChartsModule, 'api.downloadChart', this.context.getGridId())) {\n return this.chartService.downloadChart(params);\n }\n }\n /** Open the Chart Tool Panel. */\n openChartToolPanel(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.GridChartsModule, 'api.openChartToolPanel', this.context.getGridId())) {\n return this.chartService.openChartToolPanel(params);\n }\n }\n /** Close the Chart Tool Panel. */\n closeChartToolPanel(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.GridChartsModule, 'api.closeChartToolPanel', this.context.getGridId())) {\n return this.chartService.closeChartToolPanel(params.chartId);\n }\n }\n /** Used to programmatically create charts from a range. */\n createRangeChart(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.GridChartsModule, 'api.createRangeChart', this.context.getGridId())) {\n return this.chartService.createRangeChart(params);\n }\n }\n /** Used to programmatically create pivot charts from a grid. */\n createPivotChart(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.GridChartsModule, 'api.createPivotChart', this.context.getGridId())) {\n return this.chartService.createPivotChart(params);\n }\n }\n /** Used to programmatically create cross filter charts from a range. */\n createCrossFilterChart(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.GridChartsModule, 'api.createCrossFilterChart', this.context.getGridId())) {\n return this.chartService.createCrossFilterChart(params);\n }\n }\n /** Used to programmatically update a chart. */\n updateChart(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.GridChartsModule, 'api.updateChart', this.context.getGridId())) {\n this.chartService.updateChart(params);\n }\n }\n /** Restores a chart using the `ChartModel` that was previously obtained from `getChartModels()`. */\n restoreChart(chartModel, chartContainer) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.GridChartsModule, 'api.restoreChart', this.context.getGridId())) {\n return this.chartService.restoreChart(chartModel, chartContainer);\n }\n }\n /** Copies data to clipboard by following the same rules as pressing Ctrl+C. */\n copyToClipboard(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.ClipboardModule, 'api.copyToClipboard', this.context.getGridId())) {\n this.clipboardService.copyToClipboard(params);\n }\n }\n /** Cuts data to clipboard by following the same rules as pressing Ctrl+X. */\n cutToClipboard(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.ClipboardModule, 'api.cutToClipboard', this.context.getGridId())) {\n this.clipboardService.cutToClipboard(params, 'api');\n }\n }\n /** Copies the selected rows to the clipboard. */\n copySelectedRowsToClipboard(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.ClipboardModule, 'api.copySelectedRowsToClipboard', this.context.getGridId())) {\n this.clipboardService.copySelectedRowsToClipboard(params);\n }\n }\n /** Copies the selected ranges to the clipboard. */\n copySelectedRangeToClipboard(params) {\n if (ModuleRegistry.__assertRegistered(ModuleNames.ClipboardModule, 'api.copySelectedRangeToClipboard', this.context.getGridId())) {\n this.clipboardService.copySelectedRangeToClipboard(params);\n }\n }\n /** Copies the selected range down, similar to `Ctrl + D` in Excel. */\n copySelectedRangeDown() {\n if (ModuleRegistry.__assertRegistered(ModuleNames.ClipboardModule, 'api.copySelectedRangeDown', this.context.getGridId())) {\n this.clipboardService.copyRangeDown();\n }\n }\n /** Pastes the data from the Clipboard into the focused cell of the grid. If no grid cell is focused, calling this method has no effect. */\n pasteFromClipboard() {\n if (ModuleRegistry.__assertRegistered(ModuleNames.ClipboardModule, 'api.pasteFromClipboard', this.context.getGridId())) {\n this.clipboardService.pasteFromClipboard();\n }\n }\n /** Shows the column menu after and positions it relative to the provided button element. Use in conjunction with your own header template. */\n showColumnMenuAfterButtonClick(colKey, buttonElement) {\n // use grid column so works with pivot mode\n const column = this.columnModel.getGridColumn(colKey);\n this.menuFactory.showMenuAfterButtonClick(column, buttonElement, 'columnMenu');\n }\n /** Shows the column menu after and positions it relative to the mouse event. Use in conjunction with your own header template. */\n showColumnMenuAfterMouseClick(colKey, mouseEvent) {\n // use grid column so works with pivot mode\n let column = this.columnModel.getGridColumn(colKey);\n if (!column) {\n column = this.columnModel.getPrimaryColumn(colKey);\n }\n if (!column) {\n console.error(`AG Grid: column '${colKey}' not found`);\n return;\n }\n this.menuFactory.showMenuAfterMouseEvent(column, mouseEvent);\n }\n /** Hides any visible context menu or column menu. */\n hidePopupMenu() {\n // hide the context menu if in enterprise\n if (this.contextMenuFactory) {\n this.contextMenuFactory.hideActiveMenu();\n }\n // and hide the column menu always\n this.menuFactory.hideActiveMenu();\n }\n /** DOM element to use as the popup parent for grid popups (context menu, column menu etc). */\n setPopupParent(ePopupParent) {\n this.gos.set('popupParent', ePopupParent);\n }\n /** Navigates the grid focus to the next cell, as if tabbing. */\n tabToNextCell(event) {\n return this.navigationService.tabToNextCell(false, event);\n }\n /** Navigates the grid focus to the previous cell, as if shift-tabbing. */\n tabToPreviousCell(event) {\n return this.navigationService.tabToNextCell(true, event);\n }\n /** Returns the list of active cell renderer instances. */\n getCellRendererInstances(params = {}) {\n const res = this.rowRenderer.getCellRendererInstances(params);\n const unwrapped = res.map(unwrapUserComp);\n return unwrapped;\n }\n /** Returns the list of active cell editor instances. Optionally provide parameters to restrict to certain columns / row nodes. */\n getCellEditorInstances(params = {}) {\n const res = this.rowRenderer.getCellEditorInstances(params);\n const unwrapped = res.map(unwrapUserComp);\n return unwrapped;\n }\n /** If the grid is editing, returns back details of the editing cell(s). */\n getEditingCells() {\n return this.rowRenderer.getEditingCells();\n }\n /** If a cell is editing, it stops the editing. Pass `true` if you want to cancel the editing (i.e. don't accept changes). */\n stopEditing(cancel = false) {\n this.rowRenderer.stopEditing(cancel);\n }\n /** Start editing the provided cell. If another cell is editing, the editing will be stopped in that other cell. */\n startEditingCell(params) {\n const column = this.columnModel.getGridColumn(params.colKey);\n if (!column) {\n console.warn(`AG Grid: no column found for ${params.colKey}`);\n return;\n }\n const cellPosition = {\n rowIndex: params.rowIndex,\n rowPinned: params.rowPinned || null,\n column: column\n };\n const notPinned = params.rowPinned == null;\n if (notPinned) {\n this.gridBodyCtrl.getScrollFeature().ensureIndexVisible(params.rowIndex);\n }\n const cell = this.navigationService.getCellByPosition(cellPosition);\n if (!cell) {\n return;\n }\n if (!this.focusService.isCellFocused(cellPosition)) {\n this.focusService.setFocusedCell(cellPosition);\n }\n cell.startRowOrCellEdit(params.key);\n }\n /** Add an aggregation function with the specified key. */\n addAggFunc(key, aggFunc) {\n if (this.aggFuncService) {\n this.aggFuncService.addAggFunc(key, aggFunc);\n }\n }\n /** Add aggregations function with the specified keys. */\n addAggFuncs(aggFuncs) {\n if (this.aggFuncService) {\n this.aggFuncService.addAggFuncs(aggFuncs);\n }\n }\n /** Clears all aggregation functions (including those provided by the grid). */\n clearAggFuncs() {\n if (this.aggFuncService) {\n this.aggFuncService.clear();\n }\n }\n /** Apply transactions to the server side row model. */\n applyServerSideTransaction(transaction) {\n if (!this.serverSideTransactionManager) {\n this.logMissingRowModel('applyServerSideTransaction', 'serverSide');\n return;\n }\n return this.serverSideTransactionManager.applyTransaction(transaction);\n }\n /** Batch apply transactions to the server side row model. */\n applyServerSideTransactionAsync(transaction, callback) {\n if (!this.serverSideTransactionManager) {\n this.logMissingRowModel('applyServerSideTransactionAsync', 'serverSide');\n return;\n }\n return this.serverSideTransactionManager.applyTransactionAsync(transaction, callback);\n }\n /** Gets all failed server side loads to retry. */\n retryServerSideLoads() {\n if (!this.serverSideRowModel) {\n this.logMissingRowModel('retryServerSideLoads', 'serverSide');\n return;\n }\n this.serverSideRowModel.retryLoads();\n }\n flushServerSideAsyncTransactions() {\n if (!this.serverSideTransactionManager) {\n this.logMissingRowModel('flushServerSideAsyncTransactions', 'serverSide');\n return;\n }\n return this.serverSideTransactionManager.flushAsyncTransactions();\n }\n /** Update row data. Pass a transaction object with lists for `add`, `remove` and `update`. */\n applyTransaction(rowDataTransaction) {\n if (!this.clientSideRowModel) {\n this.logMissingRowModel('applyTransaction', 'clientSide');\n return;\n }\n return this.clientSideRowModel.updateRowData(rowDataTransaction);\n }\n /** Same as `applyTransaction` except executes asynchronously for efficiency. */\n applyTransactionAsync(rowDataTransaction, callback) {\n if (!this.clientSideRowModel) {\n this.logMissingRowModel('applyTransactionAsync', 'clientSide');\n return;\n }\n this.clientSideRowModel.batchUpdateRowData(rowDataTransaction, callback);\n }\n /** Executes any remaining asynchronous grid transactions, if any are waiting to be executed. */\n flushAsyncTransactions() {\n if (!this.clientSideRowModel) {\n this.logMissingRowModel('flushAsyncTransactions', 'clientSide');\n return;\n }\n this.clientSideRowModel.flushAsyncTransactions();\n }\n setSuppressModelUpdateAfterUpdateTransaction(value) {\n this.gos.set('suppressModelUpdateAfterUpdateTransaction', value);\n }\n /**\n * Marks all the currently loaded blocks in the cache for reload.\n * If you have 10 blocks in the cache, all 10 will be marked for reload.\n * The old data will continue to be displayed until the new data is loaded.\n */\n refreshInfiniteCache() {\n if (this.infiniteRowModel) {\n this.infiniteRowModel.refreshCache();\n }\n else {\n this.logMissingRowModel('refreshInfiniteCache', 'infinite');\n }\n }\n /**\n * Purges the cache.\n * The grid is then told to refresh. Only the blocks required to display the current data on screen are fetched (typically no more than 2).\n * The grid will display nothing while the new blocks are loaded.\n * Use this to immediately remove the old data from the user.\n */\n purgeInfiniteCache() {\n if (this.infiniteRowModel) {\n this.infiniteRowModel.purgeCache();\n }\n else {\n this.logMissingRowModel('purgeInfiniteCache', 'infinite');\n }\n }\n /**\n * Refresh a server-side store level.\n * If you pass no parameters, then the top level store is refreshed.\n * To refresh a child level, pass in the string of keys to get to the desired level.\n * Once the store refresh is complete, the storeRefreshed event is fired.\n */\n refreshServerSide(params) {\n if (!this.serverSideRowModel) {\n this.logMissingRowModel('refreshServerSide', 'serverSide');\n return;\n }\n this.serverSideRowModel.refreshStore(params);\n }\n /** @deprecated v28 use `refreshServerSide` instead */\n refreshServerSideStore(params) {\n logDeprecation('28.0', 'refreshServerSideStore', 'refreshServerSide');\n return this.refreshServerSide(params);\n }\n /** @deprecated v28 use `getServerSideGroupLevelState` instead */\n getServerSideStoreState() {\n logDeprecation('28.0', 'getServerSideStoreState', 'getServerSideGroupLevelState');\n return this.getServerSideGroupLevelState();\n }\n /** Returns info on all server side group levels. */\n getServerSideGroupLevelState() {\n if (!this.serverSideRowModel) {\n this.logMissingRowModel('getServerSideGroupLevelState', 'serverSide');\n return [];\n }\n return this.serverSideRowModel.getStoreState();\n }\n /** The row count defines how many rows the grid allows scrolling to. */\n getInfiniteRowCount() {\n if (this.infiniteRowModel) {\n return this.infiniteRowModel.getRowCount();\n }\n else {\n this.logMissingRowModel('getInfiniteRowCount', 'infinite');\n }\n }\n /** Returns `true` if grid allows for scrolling past the last row to load more rows, thus providing infinite scroll. */\n isLastRowIndexKnown() {\n if (this.infiniteRowModel) {\n return this.infiniteRowModel.isLastRowIndexKnown();\n }\n else {\n this.logMissingRowModel('isLastRowIndexKnown', 'infinite');\n }\n }\n /**\n * Returns an object representing the state of the cache. This is useful for debugging and understanding how the cache is working.\n */\n getCacheBlockState() {\n return this.rowNodeBlockLoader.getBlockState();\n }\n /** Get the index of the first displayed row due to scrolling (includes invisible rendered rows in the buffer). */\n getFirstDisplayedRow() {\n return this.rowRenderer.getFirstVirtualRenderedRow();\n }\n /** Get the index of the last displayed row due to scrolling (includes invisible rendered rows in the buffer). */\n getLastDisplayedRow() {\n return this.rowRenderer.getLastVirtualRenderedRow();\n }\n /** Returns the displayed `RowNode` at the given `index`. */\n getDisplayedRowAtIndex(index) {\n return this.rowModel.getRow(index);\n }\n /** Returns the total number of displayed rows. */\n getDisplayedRowCount() {\n return this.rowModel.getRowCount();\n }\n /** Resets the data type definitions. This will update the columns in the grid. */\n setDataTypeDefinitions(dataTypeDefinitions) {\n this.gos.set('dataTypeDefinitions', dataTypeDefinitions);\n }\n /**\n * Set whether the grid paginates the data or not.\n * - `true` to enable pagination\n * - `false` to disable pagination\n */\n setPagination(value) {\n this.gos.set('pagination', value);\n }\n /**\n * Returns `true` when the last page is known.\n * This will always be `true` if you are using the Client-Side Row Model for pagination.\n * Returns `false` when the last page is not known; this only happens when using Infinite Row Model.\n */\n paginationIsLastPageFound() {\n return this.paginationProxy.isLastPageFound();\n }\n /** Returns how many rows are being shown per page. */\n paginationGetPageSize() {\n return this.paginationProxy.getPageSize();\n }\n /** Sets the `paginationPageSize`, then re-paginates the grid so the changes are applied immediately. */\n paginationSetPageSize(size) {\n this.gos.set('paginationPageSize', size);\n }\n /** Returns the 0-based index of the page which is showing. */\n paginationGetCurrentPage() {\n return this.paginationProxy.getCurrentPage();\n }\n /** Returns the total number of pages. Returns `null` if `paginationIsLastPageFound() === false`. */\n paginationGetTotalPages() {\n return this.paginationProxy.getTotalPages();\n }\n /** The total number of rows. Returns `null` if `paginationIsLastPageFound() === false`. */\n paginationGetRowCount() {\n return this.paginationProxy.getMasterRowCount();\n }\n /** Navigates to the next page. */\n paginationGoToNextPage() {\n this.paginationProxy.goToNextPage();\n }\n /** Navigates to the previous page. */\n paginationGoToPreviousPage() {\n this.paginationProxy.goToPreviousPage();\n }\n /** Navigates to the first page. */\n paginationGoToFirstPage() {\n this.paginationProxy.goToFirstPage();\n }\n /** Navigates to the last page. */\n paginationGoToLastPage() {\n this.paginationProxy.goToLastPage();\n }\n /** Goes to the specified page. If the page requested doesn't exist, it will go to the last page. */\n paginationGoToPage(page) {\n this.paginationProxy.goToPage(page);\n }\n};\n__decorate([\n Optional('immutableService')\n], GridApi.prototype, \"immutableService\", void 0);\n__decorate([\n Optional('csvCreator')\n], GridApi.prototype, \"csvCreator\", void 0);\n__decorate([\n Optional('excelCreator')\n], GridApi.prototype, \"excelCreator\", void 0);\n__decorate([\n Autowired('rowRenderer')\n], GridApi.prototype, \"rowRenderer\", void 0);\n__decorate([\n Autowired('navigationService')\n], GridApi.prototype, \"navigationService\", void 0);\n__decorate([\n Autowired('filterManager')\n], GridApi.prototype, \"filterManager\", void 0);\n__decorate([\n Autowired('columnModel')\n], GridApi.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('selectionService')\n], GridApi.prototype, \"selectionService\", void 0);\n__decorate([\n Autowired('gridOptionsService')\n], GridApi.prototype, \"gos\", void 0);\n__decorate([\n Autowired('valueService')\n], GridApi.prototype, \"valueService\", void 0);\n__decorate([\n Autowired('alignedGridsService')\n], GridApi.prototype, \"alignedGridsService\", void 0);\n__decorate([\n Autowired('eventService')\n], GridApi.prototype, \"eventService\", void 0);\n__decorate([\n Autowired('pinnedRowModel')\n], GridApi.prototype, \"pinnedRowModel\", void 0);\n__decorate([\n Autowired('context')\n], GridApi.prototype, \"context\", void 0);\n__decorate([\n Autowired('rowModel')\n], GridApi.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('sortController')\n], GridApi.prototype, \"sortController\", void 0);\n__decorate([\n Autowired('paginationProxy')\n], GridApi.prototype, \"paginationProxy\", void 0);\n__decorate([\n Autowired('focusService')\n], GridApi.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('dragAndDropService')\n], GridApi.prototype, \"dragAndDropService\", void 0);\n__decorate([\n Optional('rangeService')\n], GridApi.prototype, \"rangeService\", void 0);\n__decorate([\n Optional('clipboardService')\n], GridApi.prototype, \"clipboardService\", void 0);\n__decorate([\n Optional('aggFuncService')\n], GridApi.prototype, \"aggFuncService\", void 0);\n__decorate([\n Autowired('menuFactory')\n], GridApi.prototype, \"menuFactory\", void 0);\n__decorate([\n Optional('contextMenuFactory')\n], GridApi.prototype, \"contextMenuFactory\", void 0);\n__decorate([\n Autowired('valueCache')\n], GridApi.prototype, \"valueCache\", void 0);\n__decorate([\n Autowired('animationFrameService')\n], GridApi.prototype, \"animationFrameService\", void 0);\n__decorate([\n Optional('statusBarService')\n], GridApi.prototype, \"statusBarService\", void 0);\n__decorate([\n Optional('chartService')\n], GridApi.prototype, \"chartService\", void 0);\n__decorate([\n Optional('undoRedoService')\n], GridApi.prototype, \"undoRedoService\", void 0);\n__decorate([\n Optional('rowNodeBlockLoader')\n], GridApi.prototype, \"rowNodeBlockLoader\", void 0);\n__decorate([\n Optional('ssrmTransactionManager')\n], GridApi.prototype, \"serverSideTransactionManager\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], GridApi.prototype, \"ctrlsService\", void 0);\n__decorate([\n PostConstruct\n], GridApi.prototype, \"init\", null);\n__decorate([\n PreDestroy\n], GridApi.prototype, \"cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid\", null);\nGridApi = __decorate([\n Bean('gridApi')\n], GridApi);\nexport { GridApi };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar FilterManager_1;\nimport { AgPromise, _ } from '../utils/index.mjs';\nimport { Column } from '../entities/column.mjs';\nimport { Autowired, Bean, Optional, PostConstruct } from '../context/context.mjs';\nimport { Events } from '../events.mjs';\nimport { ModuleNames } from '../modules/moduleNames.mjs';\nimport { ModuleRegistry } from '../modules/moduleRegistry.mjs';\nimport { BeanStub } from '../context/beanStub.mjs';\nimport { convertToSet } from '../utils/set.mjs';\nimport { exists } from '../utils/generic.mjs';\nimport { mergeDeep, cloneObject } from '../utils/object.mjs';\nimport { loadTemplate } from '../utils/dom.mjs';\nimport { FilterComponent } from '../components/framework/componentTypes.mjs';\nimport { unwrapUserComp } from '../gridApi.mjs';\nimport { doOnce } from '../utils/function.mjs';\nlet FilterManager = FilterManager_1 = class FilterManager extends BeanStub {\n constructor() {\n super(...arguments);\n this.allColumnFilters = new Map();\n this.allColumnListeners = new Map();\n this.activeAggregateFilters = [];\n this.activeColumnFilters = [];\n this.quickFilter = null;\n this.quickFilterParts = null;\n // this is true when the grid is processing the filter change. this is used by the cell comps, so that they\n // don't flash when data changes due to filter changes. there is no need to flash when filter changes as the\n // user is in control, so doesn't make sense to show flashing changes. for example, go to main demo where\n // this feature is turned off (hack code to always return false for isSuppressFlashingCellsBecauseFiltering(), put in)\n // 100,000 rows and group by country. then do some filtering. all the cells flash, which is silly.\n this.processingFilterChange = false;\n // when we're waiting for cell data types to be inferred, we need to defer filter model updates\n this.filterModelUpdateQueue = [];\n }\n init() {\n this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, () => this.onColumnsChanged());\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, () => this.refreshFiltersForAggregations());\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_CHANGED, () => this.refreshFiltersForAggregations());\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, () => {\n this.refreshFiltersForAggregations();\n this.resetQuickFilterCache();\n });\n this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, () => {\n this.resetQuickFilterCache();\n this.updateAdvancedFilterColumns();\n });\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, () => this.resetQuickFilterCache());\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, () => {\n if (!this.gridOptionsService.is('includeHiddenColumnsInQuickFilter')) {\n this.resetQuickFilterCache();\n }\n this.updateAdvancedFilterColumns();\n });\n this.addManagedPropertyListener('quickFilterText', (e) => this.setQuickFilter(e.currentValue));\n this.addManagedPropertyListener('includeHiddenColumnsInQuickFilter', () => this.onIncludeHiddenColumnsInQuickFilterChanged());\n this.quickFilter = this.parseQuickFilter(this.gridOptionsService.get('quickFilterText'));\n this.setQuickFilterParts();\n this.allowShowChangeAfterFilter = this.gridOptionsService.is('allowShowChangeAfterFilter');\n this.externalFilterPresent = this.isExternalFilterPresentCallback();\n this.updateAggFiltering();\n this.addManagedPropertyListener('groupAggFiltering', () => this.updateAggFiltering());\n this.addManagedPropertyListener('advancedFilterModel', (event) => this.setAdvancedFilterModel(event.currentValue));\n this.addManagedListener(this.eventService, Events.EVENT_ADVANCED_FILTER_ENABLED_CHANGED, ({ enabled }) => this.onAdvancedFilterEnabledChanged(enabled));\n this.addManagedListener(this.eventService, Events.EVENT_DATA_TYPES_INFERRED, () => this.processFilterModelUpdateQueue());\n }\n isExternalFilterPresentCallback() {\n const isFilterPresent = this.gridOptionsService.getCallback('isExternalFilterPresent');\n if (typeof isFilterPresent === 'function') {\n return isFilterPresent({});\n }\n return false;\n }\n doesExternalFilterPass(node) {\n const doesFilterPass = this.gridOptionsService.get('doesExternalFilterPass');\n if (typeof doesFilterPass === 'function') {\n return doesFilterPass(node);\n }\n return false;\n }\n setQuickFilterParts() {\n this.quickFilterParts = this.quickFilter ? this.quickFilter.split(' ') : null;\n }\n setFilterModel(model) {\n if (this.isAdvancedFilterEnabled()) {\n this.warnAdvancedFilters();\n return;\n }\n if (this.dataTypeService.isPendingInference()) {\n this.filterModelUpdateQueue.push(model);\n return;\n }\n const allPromises = [];\n const previousModel = this.getFilterModel();\n if (model) {\n // mark the filters as we set them, so any active filters left over we stop\n const modelKeys = convertToSet(Object.keys(model));\n this.allColumnFilters.forEach((filterWrapper, colId) => {\n const newModel = model[colId];\n allPromises.push(this.setModelOnFilterWrapper(filterWrapper.filterPromise, newModel));\n modelKeys.delete(colId);\n });\n // at this point, processedFields contains data for which we don't have a filter working yet\n modelKeys.forEach(colId => {\n const column = this.columnModel.getPrimaryColumn(colId) || this.columnModel.getGridColumn(colId);\n if (!column) {\n console.warn('AG Grid: setFilterModel() - no column found for colId: ' + colId);\n return;\n }\n if (!column.isFilterAllowed()) {\n console.warn('AG Grid: setFilterModel() - unable to fully apply model, filtering disabled for colId: ' + colId);\n return;\n }\n const filterWrapper = this.getOrCreateFilterWrapper(column, 'NO_UI');\n if (!filterWrapper) {\n console.warn('AG-Grid: setFilterModel() - unable to fully apply model, unable to create filter for colId: ' + colId);\n return;\n }\n allPromises.push(this.setModelOnFilterWrapper(filterWrapper.filterPromise, model[colId]));\n });\n }\n else {\n this.allColumnFilters.forEach(filterWrapper => {\n allPromises.push(this.setModelOnFilterWrapper(filterWrapper.filterPromise, null));\n });\n }\n AgPromise.all(allPromises).then(() => {\n const currentModel = this.getFilterModel();\n const columns = [];\n this.allColumnFilters.forEach((filterWrapper, colId) => {\n const before = previousModel ? previousModel[colId] : null;\n const after = currentModel ? currentModel[colId] : null;\n if (!_.jsonEquals(before, after)) {\n columns.push(filterWrapper.column);\n }\n });\n if (columns.length > 0) {\n this.onFilterChanged({ columns, source: 'api' });\n }\n });\n }\n setModelOnFilterWrapper(filterPromise, newModel) {\n return new AgPromise(resolve => {\n filterPromise.then(filter => {\n if (typeof filter.setModel !== 'function') {\n console.warn('AG Grid: filter missing setModel method, which is needed for setFilterModel');\n resolve();\n }\n (filter.setModel(newModel) || AgPromise.resolve()).then(() => resolve());\n });\n });\n }\n getFilterModel() {\n const result = {};\n this.allColumnFilters.forEach((filterWrapper, key) => {\n // because user can provide filters, we provide useful error checking and messages\n const filterPromise = filterWrapper.filterPromise;\n const filter = filterPromise.resolveNow(null, promiseFilter => promiseFilter);\n if (filter == null) {\n return null;\n }\n if (typeof filter.getModel !== 'function') {\n console.warn('AG Grid: filter API missing getModel method, which is needed for getFilterModel');\n return;\n }\n const model = filter.getModel();\n if (exists(model)) {\n result[key] = model;\n }\n });\n return result;\n }\n isColumnFilterPresent() {\n return this.activeColumnFilters.length > 0;\n }\n isAggregateFilterPresent() {\n return !!this.activeAggregateFilters.length;\n }\n isExternalFilterPresent() {\n return this.externalFilterPresent;\n }\n isChildFilterPresent() {\n return this.isColumnFilterPresent()\n || this.isQuickFilterPresent()\n || this.isExternalFilterPresent()\n || this.isAdvancedFilterPresent();\n }\n isAdvancedFilterPresent() {\n return this.isAdvancedFilterEnabled() && this.advancedFilterService.isFilterPresent();\n }\n onAdvancedFilterEnabledChanged(enabled) {\n var _a;\n if (enabled) {\n if (this.allColumnFilters.size) {\n this.allColumnFilters.forEach(filterWrapper => this.disposeFilterWrapper(filterWrapper, 'advancedFilterEnabled'));\n this.onFilterChanged({ source: 'advancedFilter' });\n }\n }\n else {\n if ((_a = this.advancedFilterService) === null || _a === void 0 ? void 0 : _a.isFilterPresent()) {\n this.advancedFilterService.setModel(null);\n this.onFilterChanged({ source: 'advancedFilter' });\n }\n }\n }\n isAdvancedFilterEnabled() {\n var _a;\n return (_a = this.advancedFilterService) === null || _a === void 0 ? void 0 : _a.isEnabled();\n }\n isAdvancedFilterHeaderActive() {\n return this.isAdvancedFilterEnabled() && this.advancedFilterService.isHeaderActive();\n }\n doAggregateFiltersPass(node, filterToSkip) {\n return this.doColumnFiltersPass(node, filterToSkip, true);\n }\n // called by:\n // 1) onFilterChanged()\n // 2) onNewRowsLoaded()\n updateActiveFilters() {\n this.activeColumnFilters.length = 0;\n this.activeAggregateFilters.length = 0;\n const isFilterActive = (filter) => {\n if (!filter) {\n return false;\n } // this never happens, including to avoid compile error\n if (!filter.isFilterActive) {\n console.warn('AG Grid: Filter is missing isFilterActive() method');\n return false;\n }\n return filter.isFilterActive();\n };\n const groupFilterEnabled = !!this.gridOptionsService.getGroupAggFiltering();\n const isAggFilter = (column) => {\n const isSecondary = !column.isPrimary();\n // the only filters that can appear on secondary columns are groupAgg filters\n if (isSecondary) {\n return true;\n }\n const isShowingPrimaryColumns = !this.columnModel.isPivotActive();\n const isValueActive = column.isValueActive();\n // primary columns are only ever groupAgg filters if a) value is active and b) showing primary columns\n if (!isValueActive || !isShowingPrimaryColumns) {\n return false;\n }\n // from here on we know: isPrimary=true, isValueActive=true, isShowingPrimaryColumns=true\n if (this.columnModel.isPivotMode()) {\n // primary column is pretending to be a pivot column, ie pivotMode=true, but we are\n // still showing primary columns\n return true;\n }\n // we are not pivoting, so we groupFilter when it's an agg column\n return groupFilterEnabled;\n };\n this.allColumnFilters.forEach(filterWrapper => {\n if (filterWrapper.filterPromise.resolveNow(false, isFilterActive)) {\n const filterComp = filterWrapper.filterPromise.resolveNow(null, filter => filter);\n if (isAggFilter(filterWrapper.column)) {\n this.activeAggregateFilters.push(filterComp);\n }\n else {\n this.activeColumnFilters.push(filterComp);\n }\n }\n });\n }\n updateFilterFlagInColumns(source, additionalEventAttributes) {\n this.allColumnFilters.forEach(filterWrapper => {\n const isFilterActive = filterWrapper.filterPromise.resolveNow(false, filter => filter.isFilterActive());\n filterWrapper.column.setFilterActive(isFilterActive, source, additionalEventAttributes);\n });\n }\n isAnyFilterPresent() {\n return this.isQuickFilterPresent() || this.isColumnFilterPresent() || this.isAggregateFilterPresent() || this.isExternalFilterPresent();\n }\n doColumnFiltersPass(node, filterToSkip, targetAggregates) {\n const { data, aggData } = node;\n const targetedFilters = targetAggregates ? this.activeAggregateFilters : this.activeColumnFilters;\n const targetedData = targetAggregates ? aggData : data;\n for (let i = 0; i < targetedFilters.length; i++) {\n const filter = targetedFilters[i];\n if (filter == null || filter === filterToSkip) {\n continue;\n }\n if (typeof filter.doesFilterPass !== 'function') {\n // because users can do custom filters, give nice error message\n throw new Error('Filter is missing method doesFilterPass');\n }\n if (!filter.doesFilterPass({ node, data: targetedData })) {\n return false;\n }\n }\n return true;\n }\n parseQuickFilter(newFilter) {\n if (!exists(newFilter)) {\n return null;\n }\n if (!this.gridOptionsService.isRowModelType('clientSide')) {\n console.warn('AG Grid - Quick filtering only works with the Client-Side Row Model');\n return null;\n }\n return newFilter.toUpperCase();\n }\n setQuickFilter(newFilter) {\n if (newFilter != null && typeof newFilter !== 'string') {\n console.warn(`AG Grid - setQuickFilter() only supports string inputs, received: ${typeof newFilter}`);\n return;\n }\n const parsedFilter = this.parseQuickFilter(newFilter);\n if (this.quickFilter !== parsedFilter) {\n this.quickFilter = parsedFilter;\n this.setQuickFilterParts();\n this.onFilterChanged({ source: 'quickFilter' });\n }\n }\n resetQuickFilterCache() {\n this.rowModel.forEachNode(node => node.quickFilterAggregateText = null);\n }\n onIncludeHiddenColumnsInQuickFilterChanged() {\n this.columnModel.refreshQuickFilterColumns();\n this.resetQuickFilterCache();\n if (this.isQuickFilterPresent()) {\n this.onFilterChanged({ source: 'quickFilter' });\n }\n }\n refreshFiltersForAggregations() {\n const isAggFiltering = this.gridOptionsService.getGroupAggFiltering();\n if (isAggFiltering) {\n this.onFilterChanged();\n }\n }\n // sometimes (especially in React) the filter can call onFilterChanged when we are in the middle\n // of a render cycle. this would be bad, so we wait for render cycle to complete when this happens.\n // this happens in react when we change React State in the grid (eg setting RowCtrl's in RowContainer)\n // which results in React State getting applied in the main application, triggering a useEffect() to\n // be kicked off adn then the application calling the grid's API. in AG-6554, the custom filter was\n // getting it's useEffect() triggered in this way.\n callOnFilterChangedOutsideRenderCycle(params) {\n const action = () => this.onFilterChanged(params);\n if (this.rowRenderer.isRefreshInProgress()) {\n setTimeout(action, 0);\n }\n else {\n action();\n }\n }\n onFilterChanged(params = {}) {\n const { source, filterInstance, additionalEventAttributes, columns } = params;\n this.updateDependantFilters();\n this.updateActiveFilters();\n this.updateFilterFlagInColumns('filterChanged', additionalEventAttributes);\n this.externalFilterPresent = this.isExternalFilterPresentCallback();\n this.allColumnFilters.forEach(filterWrapper => {\n if (!filterWrapper.filterPromise) {\n return;\n }\n filterWrapper.filterPromise.then(filter => {\n if (filter && filter !== filterInstance && filter.onAnyFilterChanged) {\n filter.onAnyFilterChanged();\n }\n });\n });\n const filterChangedEvent = {\n source,\n type: Events.EVENT_FILTER_CHANGED,\n columns: columns || [],\n };\n if (additionalEventAttributes) {\n mergeDeep(filterChangedEvent, additionalEventAttributes);\n }\n // because internal events are not async in ag-grid, when the dispatchEvent\n // method comes back, we know all listeners have finished executing.\n this.processingFilterChange = true;\n this.eventService.dispatchEvent(filterChangedEvent);\n this.processingFilterChange = false;\n }\n isSuppressFlashingCellsBecauseFiltering() {\n // if user has elected to always flash cell changes, then always return false, otherwise we suppress flashing\n // changes when filtering\n return !this.allowShowChangeAfterFilter && this.processingFilterChange;\n }\n isQuickFilterPresent() {\n return this.quickFilter !== null;\n }\n updateAggFiltering() {\n this.aggFiltering = !!this.gridOptionsService.getGroupAggFiltering();\n }\n isAggregateQuickFilterPresent() {\n return this.isQuickFilterPresent() && (this.aggFiltering || this.columnModel.isPivotMode());\n }\n isNonAggregateQuickFilterPresent() {\n return this.isQuickFilterPresent() && !(this.aggFiltering || this.columnModel.isPivotMode());\n }\n doesRowPassOtherFilters(filterToSkip, node) {\n return this.doesRowPassFilter({ rowNode: node, filterInstanceToSkip: filterToSkip });\n }\n doesRowPassQuickFilterNoCache(node, filterPart) {\n const columns = this.columnModel.getAllColumnsForQuickFilter();\n return columns.some(column => {\n const part = this.getQuickFilterTextForColumn(column, node);\n return exists(part) && part.indexOf(filterPart) >= 0;\n });\n }\n doesRowPassQuickFilterCache(node, filterPart) {\n if (!node.quickFilterAggregateText) {\n this.aggregateRowForQuickFilter(node);\n }\n return node.quickFilterAggregateText.indexOf(filterPart) >= 0;\n }\n doesRowPassQuickFilter(node) {\n const usingCache = this.gridOptionsService.is('cacheQuickFilter');\n // each part must pass, if any fails, then the whole filter fails\n return this.quickFilterParts.every(part => usingCache ? this.doesRowPassQuickFilterCache(node, part) : this.doesRowPassQuickFilterNoCache(node, part));\n }\n doesRowPassAggregateFilters(params) {\n // check quick filter\n if (this.isAggregateQuickFilterPresent() && !this.doesRowPassQuickFilter(params.rowNode)) {\n return false;\n }\n if (this.isAggregateFilterPresent() && !this.doAggregateFiltersPass(params.rowNode, params.filterInstanceToSkip)) {\n return false;\n }\n // got this far, all filters pass\n return true;\n }\n doesRowPassFilter(params) {\n // the row must pass ALL of the filters, so if any of them fail,\n // we return true. that means if a row passes the quick filter,\n // but fails the column filter, it fails overall\n // first up, check quick filter\n if (this.isNonAggregateQuickFilterPresent() && !this.doesRowPassQuickFilter(params.rowNode)) {\n return false;\n }\n // secondly, give the client a chance to reject this row\n if (this.isExternalFilterPresent() && !this.doesExternalFilterPass(params.rowNode)) {\n return false;\n }\n // lastly, check column filter\n if (this.isColumnFilterPresent() && !this.doColumnFiltersPass(params.rowNode, params.filterInstanceToSkip)) {\n return false;\n }\n if (this.isAdvancedFilterPresent() && !this.advancedFilterService.doesFilterPass(params.rowNode)) {\n return false;\n }\n // got this far, all filters pass\n return true;\n }\n getQuickFilterTextForColumn(column, node) {\n let value = this.valueService.getValue(column, node, true);\n const colDef = column.getColDef();\n if (colDef.getQuickFilterText) {\n const params = {\n value,\n node,\n data: node.data,\n column,\n colDef,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context\n };\n value = colDef.getQuickFilterText(params);\n }\n return exists(value) ? value.toString().toUpperCase() : null;\n }\n aggregateRowForQuickFilter(node) {\n const stringParts = [];\n const columns = this.columnModel.getAllColumnsForQuickFilter();\n columns.forEach(column => {\n const part = this.getQuickFilterTextForColumn(column, node);\n if (exists(part)) {\n stringParts.push(part);\n }\n });\n node.quickFilterAggregateText = stringParts.join(FilterManager_1.QUICK_FILTER_SEPARATOR);\n }\n onNewRowsLoaded(source) {\n this.allColumnFilters.forEach(filterWrapper => {\n filterWrapper.filterPromise.then(filter => {\n if (filter.onNewRowsLoaded) {\n filter.onNewRowsLoaded();\n }\n });\n });\n this.updateFilterFlagInColumns(source, { afterDataChange: true });\n this.updateActiveFilters();\n }\n createValueGetter(column) {\n return ({ node }) => this.valueService.getValue(column, node, true);\n }\n getFilterComponent(column, source, createIfDoesNotExist = true) {\n var _a;\n if (createIfDoesNotExist) {\n return ((_a = this.getOrCreateFilterWrapper(column, source)) === null || _a === void 0 ? void 0 : _a.filterPromise) || null;\n }\n const filterWrapper = this.cachedFilter(column);\n return filterWrapper ? filterWrapper.filterPromise : null;\n }\n isFilterActive(column) {\n const filterWrapper = this.cachedFilter(column);\n return !!filterWrapper && filterWrapper.filterPromise.resolveNow(false, filter => filter.isFilterActive());\n }\n getOrCreateFilterWrapper(column, source) {\n if (!column.isFilterAllowed()) {\n return null;\n }\n let filterWrapper = this.cachedFilter(column);\n if (!filterWrapper) {\n filterWrapper = this.createFilterWrapper(column, source);\n const colId = column.getColId();\n this.allColumnFilters.set(colId, filterWrapper);\n this.allColumnListeners.set(colId, this.addManagedListener(column, Column.EVENT_COL_DEF_CHANGED, () => this.checkDestroyFilter(colId)));\n }\n else if (source !== 'NO_UI') {\n this.putIntoGui(filterWrapper, source);\n }\n return filterWrapper;\n }\n cachedFilter(column) {\n return this.allColumnFilters.get(column.getColId());\n }\n getDefaultFilter(column) {\n let defaultFilter;\n if (ModuleRegistry.__isRegistered(ModuleNames.SetFilterModule, this.context.getGridId())) {\n defaultFilter = 'agSetColumnFilter';\n }\n else {\n const cellDataType = column.getColDef().cellDataType;\n if (cellDataType === 'number') {\n defaultFilter = 'agNumberColumnFilter';\n }\n else if (cellDataType === 'date' || cellDataType === 'dateString') {\n defaultFilter = 'agDateColumnFilter';\n }\n else {\n defaultFilter = 'agTextColumnFilter';\n }\n }\n return defaultFilter;\n }\n getDefaultFloatingFilter(column) {\n let defaultFloatingFilterType;\n if (ModuleRegistry.__isRegistered(ModuleNames.SetFilterModule, this.context.getGridId())) {\n defaultFloatingFilterType = 'agSetColumnFloatingFilter';\n }\n else {\n const cellDataType = column.getColDef().cellDataType;\n if (cellDataType === 'number') {\n defaultFloatingFilterType = 'agNumberColumnFloatingFilter';\n }\n else if (cellDataType === 'date' || cellDataType === 'dateString') {\n defaultFloatingFilterType = 'agDateColumnFloatingFilter';\n }\n else {\n defaultFloatingFilterType = 'agTextColumnFloatingFilter';\n }\n }\n return defaultFloatingFilterType;\n }\n createFilterInstance(column) {\n const defaultFilter = this.getDefaultFilter(column);\n const colDef = column.getColDef();\n let filterInstance;\n const params = Object.assign(Object.assign({}, this.createFilterParams(column, colDef)), { filterModifiedCallback: () => {\n const event = {\n type: Events.EVENT_FILTER_MODIFIED,\n column,\n filterInstance\n };\n this.eventService.dispatchEvent(event);\n }, filterChangedCallback: (additionalEventAttributes) => {\n var _a;\n const source = (_a = additionalEventAttributes === null || additionalEventAttributes === void 0 ? void 0 : additionalEventAttributes.source) !== null && _a !== void 0 ? _a : 'api';\n const params = {\n filterInstance,\n additionalEventAttributes,\n columns: [column],\n source,\n };\n this.callOnFilterChangedOutsideRenderCycle(params);\n }, doesRowPassOtherFilter: node => this.doesRowPassOtherFilters(filterInstance, node) });\n const compDetails = this.userComponentFactory.getFilterDetails(colDef, params, defaultFilter);\n if (!compDetails) {\n return { filterPromise: null, compDetails: null };\n }\n return {\n filterPromise: () => {\n const filterPromise = compDetails.newAgStackInstance();\n if (filterPromise) {\n filterPromise.then(r => filterInstance = r);\n }\n return filterPromise;\n },\n compDetails\n };\n }\n createFilterParams(column, colDef) {\n const params = {\n column,\n colDef: cloneObject(colDef),\n rowModel: this.rowModel,\n filterChangedCallback: () => { },\n filterModifiedCallback: () => { },\n valueGetter: this.createValueGetter(column),\n doesRowPassOtherFilter: () => true,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context,\n };\n return params;\n }\n createFilterWrapper(column, source) {\n var _a;\n const filterWrapper = {\n column: column,\n filterPromise: null,\n compiledElement: null,\n guiPromise: AgPromise.resolve(null),\n compDetails: null\n };\n const { filterPromise, compDetails } = this.createFilterInstance(column);\n filterWrapper.filterPromise = (_a = filterPromise === null || filterPromise === void 0 ? void 0 : filterPromise()) !== null && _a !== void 0 ? _a : null;\n filterWrapper.compDetails = compDetails;\n if (filterPromise) {\n this.putIntoGui(filterWrapper, source);\n }\n return filterWrapper;\n }\n putIntoGui(filterWrapper, source) {\n const eFilterGui = document.createElement('div');\n eFilterGui.className = 'ag-filter';\n filterWrapper.guiPromise = new AgPromise(resolve => {\n filterWrapper.filterPromise.then(filter => {\n let guiFromFilter = filter.getGui();\n if (!exists(guiFromFilter)) {\n console.warn(`AG Grid: getGui method from filter returned ${guiFromFilter}, it should be a DOM element or an HTML template string.`);\n }\n // for backwards compatibility with Angular 1 - we\n // used to allow providing back HTML from getGui().\n // once we move away from supporting Angular 1\n // directly, we can change this.\n if (typeof guiFromFilter === 'string') {\n guiFromFilter = loadTemplate(guiFromFilter);\n }\n eFilterGui.appendChild(guiFromFilter);\n resolve(eFilterGui);\n const event = {\n type: Events.EVENT_FILTER_OPENED,\n column: filterWrapper.column,\n source,\n eGui: eFilterGui\n };\n this.eventService.dispatchEvent(event);\n });\n });\n }\n onColumnsChanged() {\n const columns = [];\n this.allColumnFilters.forEach((wrapper, colId) => {\n let currentColumn;\n if (wrapper.column.isPrimary()) {\n currentColumn = this.columnModel.getPrimaryColumn(colId);\n }\n else {\n currentColumn = this.columnModel.getGridColumn(colId);\n }\n if (currentColumn) {\n return;\n }\n columns.push(wrapper.column);\n this.disposeFilterWrapper(wrapper, 'columnChanged');\n this.disposeColumnListener(colId);\n });\n if (columns.length > 0) {\n // When a filter changes as a side effect of a column changes,\n // we report 'api' as the source, so that the client can distinguish\n this.onFilterChanged({ columns, source: 'api' });\n }\n else {\n // onFilterChanged does this already\n this.updateDependantFilters();\n }\n }\n updateDependantFilters() {\n // Group column filters can be dependant on underlying column filters, but don't normally get created until they're used for the first time.\n // Instead, create them by default when any filter changes.\n const groupColumns = this.columnModel.getGroupAutoColumns();\n groupColumns === null || groupColumns === void 0 ? void 0 : groupColumns.forEach(groupColumn => {\n if (groupColumn.getColDef().filter === 'agGroupColumnFilter') {\n this.getOrCreateFilterWrapper(groupColumn, 'NO_UI');\n }\n });\n }\n // for group filters, can change dynamically whether they are allowed or not\n isFilterAllowed(column) {\n var _a, _b;\n if (this.isAdvancedFilterEnabled()) {\n return false;\n }\n const isFilterAllowed = column.isFilterAllowed();\n if (!isFilterAllowed) {\n return false;\n }\n const filterWrapper = this.allColumnFilters.get(column.getColId());\n return (_b = (_a = filterWrapper === null || filterWrapper === void 0 ? void 0 : filterWrapper.filterPromise) === null || _a === void 0 ? void 0 : _a.resolveNow(true, \n // defer to filter component isFilterAllowed if it exists\n filter => {\n var _a, _b;\n return (typeof ((_a = filter) === null || _a === void 0 ? void 0 : _a.isFilterAllowed) === 'function')\n ? (_b = filter) === null || _b === void 0 ? void 0 : _b.isFilterAllowed()\n : true;\n })) !== null && _b !== void 0 ? _b : true;\n }\n getFloatingFilterCompDetails(column, showParentFilter) {\n const colDef = column.getColDef();\n const filterParams = this.createFilterParams(column, colDef);\n const finalFilterParams = this.userComponentFactory.mergeParamsWithApplicationProvidedParams(colDef, FilterComponent, filterParams);\n let defaultFloatingFilterType = this.userComponentFactory.getDefaultFloatingFilterType(colDef, () => this.getDefaultFloatingFilter(column));\n if (defaultFloatingFilterType == null) {\n defaultFloatingFilterType = 'agReadOnlyFloatingFilter';\n }\n const parentFilterInstance = (callback) => {\n const filterComponent = this.getFilterComponent(column, 'NO_UI');\n if (filterComponent == null) {\n return;\n }\n filterComponent.then(instance => {\n callback(unwrapUserComp(instance));\n });\n };\n const params = {\n column: column,\n filterParams: finalFilterParams,\n currentParentModel: () => this.getCurrentFloatingFilterParentModel(column),\n parentFilterInstance,\n showParentFilter,\n suppressFilterButton: false // This one might be overridden from the colDef\n };\n return this.userComponentFactory.getFloatingFilterCompDetails(colDef, params, defaultFloatingFilterType);\n }\n getCurrentFloatingFilterParentModel(column) {\n const filterComponent = this.getFilterComponent(column, 'NO_UI', false);\n return filterComponent ? filterComponent.resolveNow(null, filter => filter && filter.getModel()) : null;\n }\n // destroys the filter, so it no longer takes part\n destroyFilter(column, source = 'api') {\n const colId = column.getColId();\n const filterWrapper = this.allColumnFilters.get(colId);\n this.disposeColumnListener(colId);\n if (filterWrapper) {\n this.disposeFilterWrapper(filterWrapper, source);\n this.onFilterChanged({\n columns: [column],\n source: 'api',\n });\n }\n }\n disposeColumnListener(colId) {\n const columnListener = this.allColumnListeners.get(colId);\n if (columnListener) {\n this.allColumnListeners.delete(colId);\n columnListener();\n }\n }\n disposeFilterWrapper(filterWrapper, source) {\n filterWrapper.filterPromise.then(filter => {\n (filter.setModel(null) || AgPromise.resolve()).then(() => {\n this.getContext().destroyBean(filter);\n filterWrapper.column.setFilterActive(false, 'filterDestroyed');\n this.allColumnFilters.delete(filterWrapper.column.getColId());\n const event = {\n type: Events.EVENT_FILTER_DESTROYED,\n source,\n column: filterWrapper.column,\n };\n this.eventService.dispatchEvent(event);\n });\n });\n }\n checkDestroyFilter(colId) {\n const filterWrapper = this.allColumnFilters.get(colId);\n if (!filterWrapper) {\n return;\n }\n const column = filterWrapper.column;\n const { compDetails } = column.isFilterAllowed()\n ? this.createFilterInstance(column)\n : { compDetails: null };\n if (this.areFilterCompsDifferent(filterWrapper.compDetails, compDetails)) {\n this.destroyFilter(column, 'columnChanged');\n }\n }\n areFilterCompsDifferent(oldCompDetails, newCompDetails) {\n if (!newCompDetails || !oldCompDetails) {\n return true;\n }\n const { componentClass: oldComponentClass } = oldCompDetails;\n const { componentClass: newComponentClass } = newCompDetails;\n const isSameComponentClass = oldComponentClass === newComponentClass ||\n // react hooks returns new wrappers, so check nested render method\n ((oldComponentClass === null || oldComponentClass === void 0 ? void 0 : oldComponentClass.render) && (newComponentClass === null || newComponentClass === void 0 ? void 0 : newComponentClass.render) &&\n oldComponentClass.render === newComponentClass.render);\n return !isSameComponentClass;\n }\n getAdvancedFilterModel() {\n return this.isAdvancedFilterEnabled() ? this.advancedFilterService.getModel() : null;\n }\n setAdvancedFilterModel(expression) {\n if (!this.isAdvancedFilterEnabled()) {\n return;\n }\n this.advancedFilterService.setModel(expression);\n this.onFilterChanged({ source: 'advancedFilter' });\n }\n updateAdvancedFilterColumns() {\n if (!this.isAdvancedFilterEnabled()) {\n return;\n }\n if (this.advancedFilterService.updateValidity()) {\n this.onFilterChanged({ source: 'advancedFilter' });\n }\n }\n hasFloatingFilters() {\n if (this.isAdvancedFilterEnabled()) {\n return false;\n }\n const gridColumns = this.columnModel.getAllGridColumns();\n if (!gridColumns) {\n return false;\n }\n return gridColumns.some(col => col.getColDef().floatingFilter);\n }\n getFilterInstance(key, callback) {\n if (this.isAdvancedFilterEnabled()) {\n this.warnAdvancedFilters();\n return undefined;\n }\n const res = this.getFilterInstanceImpl(key, instance => {\n if (!callback) {\n return;\n }\n const unwrapped = unwrapUserComp(instance);\n callback(unwrapped);\n });\n const unwrapped = unwrapUserComp(res);\n return unwrapped;\n }\n getFilterInstanceImpl(key, callback) {\n const column = this.columnModel.getPrimaryColumn(key);\n if (!column) {\n return undefined;\n }\n const filterPromise = this.getFilterComponent(column, 'NO_UI');\n const currentValue = filterPromise && filterPromise.resolveNow(null, filterComp => filterComp);\n if (currentValue) {\n setTimeout(callback, 0, currentValue);\n }\n else if (filterPromise) {\n filterPromise.then(comp => {\n callback(comp);\n });\n }\n return currentValue;\n }\n warnAdvancedFilters() {\n doOnce(() => {\n console.warn('AG Grid: Column Filter API methods have been disabled as Advanced Filters are enabled.');\n }, 'advancedFiltersCompatibility');\n }\n setupAdvancedFilterHeaderComp(eCompToInsertBefore) {\n var _a;\n (_a = this.advancedFilterService) === null || _a === void 0 ? void 0 : _a.getCtrl().setupHeaderComp(eCompToInsertBefore);\n }\n getHeaderRowCount() {\n return this.isAdvancedFilterHeaderActive() ? 1 : 0;\n }\n getHeaderHeight() {\n return this.isAdvancedFilterHeaderActive() ? this.advancedFilterService.getCtrl().getHeaderHeight() : 0;\n }\n processFilterModelUpdateQueue() {\n this.filterModelUpdateQueue.forEach(model => this.setFilterModel(model));\n this.filterModelUpdateQueue = [];\n }\n destroy() {\n super.destroy();\n this.allColumnFilters.forEach(filterWrapper => this.disposeFilterWrapper(filterWrapper, 'gridDestroyed'));\n // don't need to destroy the listeners as they are managed listeners\n this.allColumnListeners.clear();\n }\n};\nFilterManager.QUICK_FILTER_SEPARATOR = '\\n';\n__decorate([\n Autowired('valueService')\n], FilterManager.prototype, \"valueService\", void 0);\n__decorate([\n Autowired('columnModel')\n], FilterManager.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('rowModel')\n], FilterManager.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('userComponentFactory')\n], FilterManager.prototype, \"userComponentFactory\", void 0);\n__decorate([\n Autowired('rowRenderer')\n], FilterManager.prototype, \"rowRenderer\", void 0);\n__decorate([\n Autowired('dataTypeService')\n], FilterManager.prototype, \"dataTypeService\", void 0);\n__decorate([\n Optional('advancedFilterService')\n], FilterManager.prototype, \"advancedFilterService\", void 0);\n__decorate([\n PostConstruct\n], FilterManager.prototype, \"init\", null);\nFilterManager = FilterManager_1 = __decorate([\n Bean('filterManager')\n], FilterManager);\nexport { FilterManager };\n","import { Component } from \"../../../widgets/component.mjs\";\nexport class AbstractHeaderCellComp extends Component {\n constructor(template, ctrl) {\n super(template);\n this.ctrl = ctrl;\n }\n getCtrl() {\n return this.ctrl;\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PostConstruct, PreDestroy } from '../../../context/context.mjs';\nimport { setDisplayed } from \"../../../utils/dom.mjs\";\nimport { RefSelector } from '../../../widgets/componentAnnotations.mjs';\nimport { AbstractHeaderCellComp } from '../abstractCell/abstractHeaderCellComp.mjs';\nexport class HeaderFilterCellComp extends AbstractHeaderCellComp {\n constructor(ctrl) {\n super(HeaderFilterCellComp.TEMPLATE, ctrl);\n }\n postConstruct() {\n const eGui = this.getGui();\n const compProxy = {\n addOrRemoveCssClass: (cssClassName, on) => this.addOrRemoveCssClass(cssClassName, on),\n addOrRemoveBodyCssClass: (cssClassName, on) => this.eFloatingFilterBody.classList.toggle(cssClassName, on),\n setButtonWrapperDisplayed: (displayed) => setDisplayed(this.eButtonWrapper, displayed),\n setCompDetails: compDetails => this.setCompDetails(compDetails),\n getFloatingFilterComp: () => this.compPromise,\n setWidth: width => eGui.style.width = width,\n setMenuIcon: eIcon => this.eButtonShowMainFilter.appendChild(eIcon)\n };\n this.ctrl.setComp(compProxy, eGui, this.eButtonShowMainFilter, this.eFloatingFilterBody);\n }\n setCompDetails(compDetails) {\n if (!compDetails) {\n this.destroyFloatingFilterComp();\n this.compPromise = null;\n return;\n }\n // because we are providing defaultFloatingFilterType, we know it will never be undefined;\n this.compPromise = compDetails.newAgStackInstance();\n this.compPromise.then(comp => this.afterCompCreated(comp));\n }\n destroyFloatingFilterComp() {\n if (this.floatingFilterComp) {\n this.eFloatingFilterBody.removeChild(this.floatingFilterComp.getGui());\n this.floatingFilterComp = this.destroyBean(this.floatingFilterComp);\n }\n }\n afterCompCreated(comp) {\n if (!comp) {\n return;\n }\n if (!this.isAlive()) {\n this.destroyBean(comp);\n return;\n }\n this.destroyFloatingFilterComp();\n this.floatingFilterComp = comp;\n this.eFloatingFilterBody.appendChild(comp.getGui());\n if (comp.afterGuiAttached) {\n comp.afterGuiAttached();\n }\n }\n}\nHeaderFilterCellComp.TEMPLATE = `
\n
\n
\n \n
\n
`;\n__decorate([\n RefSelector('eFloatingFilterBody')\n], HeaderFilterCellComp.prototype, \"eFloatingFilterBody\", void 0);\n__decorate([\n RefSelector('eButtonWrapper')\n], HeaderFilterCellComp.prototype, \"eButtonWrapper\", void 0);\n__decorate([\n RefSelector('eButtonShowMainFilter')\n], HeaderFilterCellComp.prototype, \"eButtonShowMainFilter\", void 0);\n__decorate([\n PostConstruct\n], HeaderFilterCellComp.prototype, \"postConstruct\", null);\n__decorate([\n PreDestroy\n], HeaderFilterCellComp.prototype, \"destroyFloatingFilterComp\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PostConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { doOnce } from \"../utils/function.mjs\";\nexport var LayoutCssClasses;\n(function (LayoutCssClasses) {\n LayoutCssClasses[\"AUTO_HEIGHT\"] = \"ag-layout-auto-height\";\n LayoutCssClasses[\"NORMAL\"] = \"ag-layout-normal\";\n LayoutCssClasses[\"PRINT\"] = \"ag-layout-print\";\n})(LayoutCssClasses || (LayoutCssClasses = {}));\nexport class LayoutFeature extends BeanStub {\n constructor(view) {\n super();\n this.view = view;\n }\n postConstruct() {\n this.addManagedPropertyListener('domLayout', this.updateLayoutClasses.bind(this));\n this.updateLayoutClasses();\n }\n updateLayoutClasses() {\n const domLayout = this.getDomLayout();\n const params = {\n autoHeight: domLayout === 'autoHeight',\n normal: domLayout === 'normal',\n print: domLayout === 'print'\n };\n const cssClass = params.autoHeight ? LayoutCssClasses.AUTO_HEIGHT :\n params.print ? LayoutCssClasses.PRINT : LayoutCssClasses.NORMAL;\n this.view.updateLayoutClasses(cssClass, params);\n }\n // returns either 'print', 'autoHeight' or 'normal' (normal is the default)\n getDomLayout() {\n var _a;\n const domLayout = (_a = this.gridOptionsService.get('domLayout')) !== null && _a !== void 0 ? _a : 'normal';\n const validLayouts = ['normal', 'print', 'autoHeight'];\n if (validLayouts.indexOf(domLayout) === -1) {\n doOnce(() => console.warn(`AG Grid: ${domLayout} is not valid for DOM Layout, valid values are 'normal', 'autoHeight', 'print'.`), 'warn about dom layout values');\n return 'normal';\n }\n return domLayout;\n }\n}\n__decorate([\n PostConstruct\n], LayoutFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { debounce } from \"../utils/function.mjs\";\nimport { isIOSUserAgent } from \"../utils/browser.mjs\";\nimport { getInnerHeight, getScrollLeft, isRtlNegativeScroll, setScrollLeft } from \"../utils/dom.mjs\";\nvar ScrollDirection;\n(function (ScrollDirection) {\n ScrollDirection[ScrollDirection[\"Vertical\"] = 0] = \"Vertical\";\n ScrollDirection[ScrollDirection[\"Horizontal\"] = 1] = \"Horizontal\";\n})(ScrollDirection || (ScrollDirection = {}));\n;\nvar ScrollSource;\n(function (ScrollSource) {\n ScrollSource[ScrollSource[\"Container\"] = 0] = \"Container\";\n ScrollSource[ScrollSource[\"FakeContainer\"] = 1] = \"FakeContainer\";\n})(ScrollSource || (ScrollSource = {}));\n;\nexport class GridBodyScrollFeature extends BeanStub {\n constructor(eBodyViewport) {\n super();\n this.lastScrollSource = [null, null];\n this.scrollLeft = -1;\n this.nextScrollTop = -1;\n this.scrollTop = -1;\n this.eBodyViewport = eBodyViewport;\n this.resetLastHScrollDebounced = debounce(() => this.lastScrollSource[ScrollDirection.Horizontal] = null, 500);\n this.resetLastVScrollDebounced = debounce(() => this.lastScrollSource[ScrollDirection.Vertical] = null, 500);\n }\n postConstruct() {\n this.enableRtl = this.gridOptionsService.is('enableRtl');\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onDisplayedColumnsWidthChanged.bind(this));\n this.ctrlsService.whenReady(p => {\n this.centerRowContainerCtrl = p.centerRowContainerCtrl;\n this.onDisplayedColumnsWidthChanged();\n this.addScrollListener();\n });\n }\n addScrollListener() {\n const fakeHScroll = this.ctrlsService.getFakeHScrollComp();\n const fakeVScroll = this.ctrlsService.getFakeVScrollComp();\n this.addManagedListener(this.centerRowContainerCtrl.getViewportElement(), 'scroll', this.onHScroll.bind(this));\n fakeHScroll.onScrollCallback(this.onFakeHScroll.bind(this));\n const isDebounce = this.gridOptionsService.is('debounceVerticalScrollbar');\n const onVScroll = isDebounce ?\n debounce(this.onVScroll.bind(this), 100) : this.onVScroll.bind(this);\n const onFakeVScroll = isDebounce ?\n debounce(this.onFakeVScroll.bind(this), 100) : this.onFakeVScroll.bind(this);\n this.addManagedListener(this.eBodyViewport, 'scroll', onVScroll);\n fakeVScroll.onScrollCallback(onFakeVScroll);\n }\n onDisplayedColumnsWidthChanged() {\n if (this.enableRtl) {\n // because RTL is all backwards, a change in the width of the row\n // can cause a change in the scroll position, without a scroll event,\n // because the scroll position in RTL is a function that depends on\n // the width. to be convinced of this, take out this line, enable RTL,\n // scroll all the way to the left and then resize a column\n this.horizontallyScrollHeaderCenterAndFloatingCenter();\n }\n }\n horizontallyScrollHeaderCenterAndFloatingCenter(scrollLeft) {\n // when doing RTL, this method gets called once prematurely\n const notYetInitialised = this.centerRowContainerCtrl == null;\n if (notYetInitialised) {\n return;\n }\n if (scrollLeft === undefined) {\n scrollLeft = this.centerRowContainerCtrl.getCenterViewportScrollLeft();\n }\n const offset = this.enableRtl ? scrollLeft : -scrollLeft;\n const topCenterContainer = this.ctrlsService.getTopCenterRowContainerCtrl();\n const stickyTopCenterContainer = this.ctrlsService.getStickyTopCenterRowContainerCtrl();\n const bottomCenterContainer = this.ctrlsService.getBottomCenterRowContainerCtrl();\n const fakeHScroll = this.ctrlsService.getFakeHScrollComp();\n const centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();\n centerHeaderContainer.setHorizontalScroll(-offset);\n bottomCenterContainer.setContainerTranslateX(offset);\n topCenterContainer.setContainerTranslateX(offset);\n stickyTopCenterContainer.setContainerTranslateX(offset);\n const centerViewport = this.centerRowContainerCtrl.getViewportElement();\n const isCenterViewportLastHorizontal = this.lastScrollSource[ScrollDirection.Horizontal] === ScrollSource.Container;\n scrollLeft = Math.abs(scrollLeft);\n if (isCenterViewportLastHorizontal) {\n fakeHScroll.setScrollPosition(scrollLeft);\n }\n else {\n setScrollLeft(centerViewport, scrollLeft, this.enableRtl);\n }\n }\n isControllingScroll(source, direction) {\n if (this.lastScrollSource[direction] == null) {\n this.lastScrollSource[direction] = source;\n return true;\n }\n return this.lastScrollSource[direction] === source;\n }\n onFakeHScroll() {\n if (!this.isControllingScroll(ScrollSource.FakeContainer, ScrollDirection.Horizontal)) {\n return;\n }\n this.onHScrollCommon(ScrollSource.FakeContainer);\n }\n onHScroll() {\n if (!this.isControllingScroll(ScrollSource.Container, ScrollDirection.Horizontal)) {\n return;\n }\n this.onHScrollCommon(ScrollSource.Container);\n }\n onHScrollCommon(source) {\n const centerContainerViewport = this.centerRowContainerCtrl.getViewportElement();\n const { scrollLeft } = centerContainerViewport;\n if (this.shouldBlockScrollUpdate(ScrollDirection.Horizontal, scrollLeft, true)) {\n return;\n }\n let newScrollLeft;\n if (source === ScrollSource.Container) {\n newScrollLeft = getScrollLeft(centerContainerViewport, this.enableRtl);\n }\n else {\n newScrollLeft = this.ctrlsService.getFakeHScrollComp().getScrollPosition();\n }\n // we do Math.round() rather than Math.floor(), to mirror how scroll values are applied.\n // eg if a scale is applied (ie user has zoomed the browser), then applying scroll=200\n // could result in 199.88, which then floor(199.88) = 199, however round(199.88) = 200.\n // initially Math.floor() was used, however this caused (almost) infinite loop with aligned grids,\n // as the scroll would move 1px at at time bouncing from one grid to the next (eg one grid would cause\n // scroll to 200px, the next to 199px, then the first back to 198px and so on).\n this.doHorizontalScroll(Math.round(newScrollLeft));\n this.resetLastHScrollDebounced();\n }\n onFakeVScroll() {\n if (!this.isControllingScroll(ScrollSource.FakeContainer, ScrollDirection.Vertical)) {\n return;\n }\n this.onVScrollCommon(ScrollSource.FakeContainer);\n }\n onVScroll() {\n if (!this.isControllingScroll(ScrollSource.Container, ScrollDirection.Vertical)) {\n return;\n }\n this.onVScrollCommon(ScrollSource.Container);\n }\n onVScrollCommon(source) {\n let scrollTop;\n if (source === ScrollSource.Container) {\n scrollTop = this.eBodyViewport.scrollTop;\n }\n else {\n scrollTop = this.ctrlsService.getFakeVScrollComp().getScrollPosition();\n }\n if (this.shouldBlockScrollUpdate(ScrollDirection.Vertical, scrollTop, true)) {\n return;\n }\n this.animationFrameService.setScrollTop(scrollTop);\n this.nextScrollTop = scrollTop;\n if (source === ScrollSource.Container) {\n this.ctrlsService.getFakeVScrollComp().setScrollPosition(scrollTop);\n }\n else {\n this.eBodyViewport.scrollTop = scrollTop;\n }\n // the `scrollGridIfNeeded` will recalculate the rows to be rendered by the grid\n // so it should only be called after `eBodyViewport` has been scrolled to the correct\n // position, otherwise the `first` and `last` row could be miscalculated.\n if (this.gridOptionsService.is('suppressAnimationFrame')) {\n this.scrollGridIfNeeded();\n }\n else {\n this.animationFrameService.schedule();\n }\n this.resetLastVScrollDebounced();\n }\n doHorizontalScroll(scrollLeft) {\n const fakeScrollLeft = this.ctrlsService.getFakeHScrollComp().getScrollPosition();\n if (this.scrollLeft === scrollLeft && scrollLeft === fakeScrollLeft) {\n return;\n }\n this.scrollLeft = scrollLeft;\n this.fireScrollEvent(ScrollDirection.Horizontal);\n this.horizontallyScrollHeaderCenterAndFloatingCenter(scrollLeft);\n this.onHorizontalViewportChanged();\n }\n fireScrollEvent(direction) {\n const bodyScrollEvent = {\n type: Events.EVENT_BODY_SCROLL,\n direction: direction === ScrollDirection.Horizontal ? 'horizontal' : 'vertical',\n left: this.scrollLeft,\n top: this.scrollTop\n };\n this.eventService.dispatchEvent(bodyScrollEvent);\n window.clearTimeout(this.scrollTimer);\n this.scrollTimer = undefined;\n this.scrollTimer = window.setTimeout(() => {\n const bodyScrollEndEvent = Object.assign(Object.assign({}, bodyScrollEvent), { type: Events.EVENT_BODY_SCROLL_END });\n this.eventService.dispatchEvent(bodyScrollEndEvent);\n }, 100);\n }\n shouldBlockScrollUpdate(direction, scrollTo, touchOnly = false) {\n // touch devices allow elastic scroll - which temporally scrolls the panel outside of the viewport\n // (eg user uses touch to go to the left of the grid, but drags past the left, the rows will actually\n // scroll past the left until the user releases the mouse). when this happens, we want ignore the scroll,\n // as otherwise it was causing the rows and header to flicker.\n // sometimes when scrolling, we got values that extended the maximum scroll allowed. we used to\n // ignore these scrolls. problem is the max scroll position could be skipped (eg the previous scroll event\n // could be 10px before the max position, and then current scroll event could be 20px after the max position).\n // if we just ignored the last event, we would be setting the scroll to 10px before the max position, when in\n // actual fact the user has exceeded the max scroll and thus scroll should be set to the max.\n if (touchOnly && !isIOSUserAgent()) {\n return false;\n }\n if (direction === ScrollDirection.Vertical) {\n return this.shouldBlockVerticalScroll(scrollTo);\n }\n return this.shouldBlockHorizontalScroll(scrollTo);\n }\n shouldBlockVerticalScroll(scrollTo) {\n const clientHeight = getInnerHeight(this.eBodyViewport);\n const { scrollHeight } = this.eBodyViewport;\n if (scrollTo < 0 || (scrollTo + clientHeight > scrollHeight)) {\n return true;\n }\n return false;\n }\n shouldBlockHorizontalScroll(scrollTo) {\n const clientWidth = this.centerRowContainerCtrl.getCenterWidth();\n const { scrollWidth } = this.centerRowContainerCtrl.getViewportElement();\n if (this.enableRtl && isRtlNegativeScroll()) {\n if (scrollTo > 0) {\n return true;\n }\n }\n else if (scrollTo < 0) {\n return true;\n }\n if (Math.abs(scrollTo) + clientWidth > scrollWidth) {\n return true;\n }\n return false;\n }\n redrawRowsAfterScroll() {\n this.fireScrollEvent(ScrollDirection.Vertical);\n }\n onHorizontalViewportChanged() {\n this.centerRowContainerCtrl.onHorizontalViewportChanged();\n }\n // this is to cater for AG-3274, where grid is removed from the dom and then inserted back in again.\n // (which happens with some implementations of tabbing). this can result in horizontal scroll getting\n // reset back to the left, however no scroll event is fired. so we need to get header to also scroll\n // back to the left to be kept in sync.\n // adding and removing the grid from the DOM both resets the scroll position and\n // triggers a resize event, so notify listeners if the scroll position has changed\n checkScrollLeft() {\n if (this.scrollLeft !== this.centerRowContainerCtrl.getCenterViewportScrollLeft()) {\n this.onHScrollCommon(ScrollSource.Container);\n }\n }\n scrollGridIfNeeded() {\n const frameNeeded = this.scrollTop != this.nextScrollTop;\n if (frameNeeded) {\n this.scrollTop = this.nextScrollTop;\n this.redrawRowsAfterScroll();\n }\n return frameNeeded;\n }\n // called by scrollHorizontally method and alignedGridsService\n setHorizontalScrollPosition(hScrollPosition, fromAlignedGridsService = false) {\n const minScrollLeft = 0;\n const maxScrollLeft = this.centerRowContainerCtrl.getViewportElement().scrollWidth - this.centerRowContainerCtrl.getCenterWidth();\n // if this is call is coming from the alignedGridsService, we don't need to validate the\n // scroll, because it has already been validated by the grid firing the scroll event.\n if (!fromAlignedGridsService && this.shouldBlockScrollUpdate(ScrollDirection.Horizontal, hScrollPosition)) {\n if (this.enableRtl && isRtlNegativeScroll()) {\n hScrollPosition = hScrollPosition > 0 ? 0 : maxScrollLeft;\n }\n else {\n hScrollPosition = Math.min(Math.max(hScrollPosition, minScrollLeft), maxScrollLeft);\n }\n }\n setScrollLeft(this.centerRowContainerCtrl.getViewportElement(), Math.abs(hScrollPosition), this.enableRtl);\n // we need to manually do the event handling (rather than wait for the event)\n // for the alignedGridsService, as if we don't, the aligned grid service gets\n // notified async, and then it's 'consuming' flag doesn't get used right, and\n // we can end up with an infinite loop\n this.doHorizontalScroll(hScrollPosition);\n }\n setVerticalScrollPosition(vScrollPosition) {\n this.eBodyViewport.scrollTop = vScrollPosition;\n }\n getVScrollPosition() {\n const result = {\n top: this.eBodyViewport.scrollTop,\n bottom: this.eBodyViewport.scrollTop + this.eBodyViewport.offsetHeight\n };\n return result;\n }\n getHScrollPosition() {\n return this.centerRowContainerCtrl.getHScrollPosition();\n }\n isHorizontalScrollShowing() {\n return this.centerRowContainerCtrl.isHorizontalScrollShowing();\n }\n // called by the headerRootComp and moveColumnController\n scrollHorizontally(pixels) {\n const oldScrollPosition = this.centerRowContainerCtrl.getViewportElement().scrollLeft;\n this.setHorizontalScrollPosition(oldScrollPosition + pixels);\n return this.centerRowContainerCtrl.getViewportElement().scrollLeft - oldScrollPosition;\n }\n // gets called by rowRenderer when new data loaded, as it will want to scroll to the top\n scrollToTop() {\n this.eBodyViewport.scrollTop = 0;\n }\n // Valid values for position are bottom, middle and top\n ensureNodeVisible(comparator, position = null) {\n // look for the node index we want to display\n const rowCount = this.rowModel.getRowCount();\n let indexToSelect = -1;\n // go through all the nodes, find the one we want to show\n for (let i = 0; i < rowCount; i++) {\n const node = this.rowModel.getRow(i);\n if (typeof comparator === 'function') {\n // Have to assert type here, as type could be TData & Function\n const predicate = comparator;\n if (node && predicate(node)) {\n indexToSelect = i;\n break;\n }\n }\n else {\n // check object equality against node and data\n if (comparator === node || comparator === node.data) {\n indexToSelect = i;\n break;\n }\n }\n }\n if (indexToSelect >= 0) {\n this.ensureIndexVisible(indexToSelect, position);\n }\n }\n // Valid values for position are bottom, middle and top\n // position should be {'top','middle','bottom', or undefined/null}.\n // if undefined/null, then the grid will to the minimal amount of scrolling,\n // eg if grid needs to scroll up, it scrolls until row is on top,\n // if grid needs to scroll down, it scrolls until row is on bottom,\n // if row is already in view, grid does not scroll\n ensureIndexVisible(index, position) {\n // if for print or auto height, everything is always visible\n if (this.gridOptionsService.isDomLayout('print')) {\n return;\n }\n const rowCount = this.paginationProxy.getRowCount();\n if (typeof index !== 'number' || index < 0 || index >= rowCount) {\n console.warn('AG Grid: Invalid row index for ensureIndexVisible: ' + index);\n return;\n }\n const isPaging = this.gridOptionsService.is('pagination');\n const paginationPanelEnabled = isPaging && !this.gridOptionsService.is('suppressPaginationPanel');\n if (!paginationPanelEnabled) {\n this.paginationProxy.goToPageWithIndex(index);\n }\n const gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();\n const stickyTopHeight = gridBodyCtrl.getStickyTopHeight();\n const rowNode = this.paginationProxy.getRow(index);\n let rowGotShiftedDuringOperation;\n do {\n const startingRowTop = rowNode.rowTop;\n const startingRowHeight = rowNode.rowHeight;\n const paginationOffset = this.paginationProxy.getPixelOffset();\n const rowTopPixel = rowNode.rowTop - paginationOffset;\n const rowBottomPixel = rowTopPixel + rowNode.rowHeight;\n const scrollPosition = this.getVScrollPosition();\n const heightOffset = this.heightScaler.getDivStretchOffset();\n const vScrollTop = scrollPosition.top + heightOffset;\n const vScrollBottom = scrollPosition.bottom + heightOffset;\n const viewportHeight = vScrollBottom - vScrollTop;\n // work out the pixels for top, middle and bottom up front,\n // make the if/else below easier to read\n const pxTop = this.heightScaler.getScrollPositionForPixel(rowTopPixel);\n const pxBottom = this.heightScaler.getScrollPositionForPixel(rowBottomPixel - viewportHeight);\n // make sure if middle, the row is not outside the top of the grid\n const pxMiddle = Math.min((pxTop + pxBottom) / 2, rowTopPixel);\n const rowAboveViewport = (vScrollTop + stickyTopHeight) > rowTopPixel;\n const rowBelowViewport = vScrollBottom < rowBottomPixel;\n let newScrollPosition = null;\n if (position === 'top') {\n newScrollPosition = pxTop;\n }\n else if (position === 'bottom') {\n newScrollPosition = pxBottom;\n }\n else if (position === 'middle') {\n newScrollPosition = pxMiddle;\n }\n else if (rowAboveViewport) {\n // if row is before, scroll up with row at top\n newScrollPosition = pxTop - stickyTopHeight;\n }\n else if (rowBelowViewport) {\n // if row is after, scroll down with row at bottom\n newScrollPosition = pxBottom;\n }\n if (newScrollPosition !== null) {\n this.setVerticalScrollPosition(newScrollPosition);\n this.rowRenderer.redraw({ afterScroll: true });\n }\n // the row can get shifted if during the rendering (during rowRenderer.redraw()),\n // the height of a row changes due to lazy calculation of row heights when using\n // colDef.autoHeight or gridOptions.getRowHeight.\n // if row was shifted, then the position we scrolled to is incorrect.\n rowGotShiftedDuringOperation = (startingRowTop !== rowNode.rowTop)\n || (startingRowHeight !== rowNode.rowHeight);\n } while (rowGotShiftedDuringOperation);\n // so when we return back to user, the cells have rendered\n this.animationFrameService.flushAllFrames();\n }\n ensureColumnVisible(key, position = 'auto') {\n const column = this.columnModel.getGridColumn(key);\n if (!column) {\n return;\n }\n // calling ensureColumnVisible on a pinned column doesn't make sense\n if (column.isPinned()) {\n return;\n }\n // defensive\n if (!this.columnModel.isColumnDisplayed(column)) {\n return;\n }\n const newHorizontalScroll = this.getPositionedHorizontalScroll(column, position);\n if (newHorizontalScroll !== null) {\n this.centerRowContainerCtrl.setCenterViewportScrollLeft(newHorizontalScroll);\n }\n // this will happen anyway, as the move will cause a 'scroll' event on the body, however\n // it is possible that the ensureColumnVisible method is called from within AG Grid and\n // the caller will need to have the columns rendered to continue, which will be before\n // the event has been worked on (which is the case for cell navigation).\n this.centerRowContainerCtrl.onHorizontalViewportChanged();\n // so when we return back to user, the cells have rendered\n this.animationFrameService.flushAllFrames();\n }\n getPositionedHorizontalScroll(column, position) {\n const { columnBeforeStart, columnAfterEnd } = this.isColumnOutsideViewport(column);\n const viewportTooSmallForColumn = this.centerRowContainerCtrl.getCenterWidth() < column.getActualWidth();\n const viewportWidth = this.centerRowContainerCtrl.getCenterWidth();\n const isRtl = this.enableRtl;\n let alignColToStart = (isRtl ? columnBeforeStart : columnAfterEnd) || viewportTooSmallForColumn;\n let alignColToEnd = isRtl ? columnAfterEnd : columnBeforeStart;\n if (position !== 'auto') {\n alignColToStart = position === 'start';\n alignColToEnd = position === 'end';\n }\n const isMiddle = position === 'middle';\n if (alignColToStart || alignColToEnd || isMiddle) {\n const { colLeft, colMiddle, colRight } = this.getColumnBounds(column);\n if (isMiddle) {\n return colMiddle - viewportWidth / 2;\n }\n if (alignColToStart) {\n return isRtl ? colRight : colLeft;\n }\n return isRtl ? (colLeft - viewportWidth) : (colRight - viewportWidth);\n }\n return null;\n }\n isColumnOutsideViewport(column) {\n const { start: viewportStart, end: viewportEnd } = this.getViewportBounds();\n const { colLeft, colRight } = this.getColumnBounds(column);\n const isRtl = this.enableRtl;\n const columnBeforeStart = isRtl ? (viewportStart > colRight) : (viewportEnd < colRight);\n const columnAfterEnd = isRtl ? (viewportEnd < colLeft) : (viewportStart > colLeft);\n return { columnBeforeStart, columnAfterEnd };\n }\n getColumnBounds(column) {\n const isRtl = this.enableRtl;\n const bodyWidth = this.columnModel.getBodyContainerWidth();\n const colWidth = column.getActualWidth();\n const colLeft = column.getLeft();\n const multiplier = isRtl ? -1 : 1;\n const colLeftPixel = isRtl ? (bodyWidth - colLeft) : colLeft;\n const colRightPixel = colLeftPixel + colWidth * multiplier;\n const colMidPixel = colLeftPixel + colWidth / 2 * multiplier;\n return { colLeft: colLeftPixel, colMiddle: colMidPixel, colRight: colRightPixel };\n }\n getViewportBounds() {\n const viewportWidth = this.centerRowContainerCtrl.getCenterWidth();\n const scrollPosition = this.centerRowContainerCtrl.getCenterViewportScrollLeft();\n const viewportStartPixel = scrollPosition;\n const viewportEndPixel = viewportWidth + scrollPosition;\n return { start: viewportStartPixel, end: viewportEndPixel, width: viewportWidth };\n }\n}\n__decorate([\n Autowired('ctrlsService')\n], GridBodyScrollFeature.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('animationFrameService')\n], GridBodyScrollFeature.prototype, \"animationFrameService\", void 0);\n__decorate([\n Autowired('paginationProxy')\n], GridBodyScrollFeature.prototype, \"paginationProxy\", void 0);\n__decorate([\n Autowired('rowModel')\n], GridBodyScrollFeature.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('rowContainerHeightService')\n], GridBodyScrollFeature.prototype, \"heightScaler\", void 0);\n__decorate([\n Autowired('rowRenderer')\n], GridBodyScrollFeature.prototype, \"rowRenderer\", void 0);\n__decorate([\n Autowired('columnModel')\n], GridBodyScrollFeature.prototype, \"columnModel\", void 0);\n__decorate([\n PostConstruct\n], GridBodyScrollFeature.prototype, \"postConstruct\", null);\n","export class AutoScrollService {\n constructor(params) {\n this.tickingInterval = null;\n this.onScrollCallback = null;\n this.scrollContainer = params.scrollContainer;\n this.scrollHorizontally = params.scrollAxis.indexOf('x') !== -1;\n this.scrollVertically = params.scrollAxis.indexOf('y') !== -1;\n this.scrollByTick = params.scrollByTick != null ? params.scrollByTick : 20;\n if (params.onScrollCallback) {\n this.onScrollCallback = params.onScrollCallback;\n }\n if (this.scrollVertically) {\n this.getVerticalPosition = params.getVerticalPosition;\n this.setVerticalPosition = params.setVerticalPosition;\n }\n if (this.scrollHorizontally) {\n this.getHorizontalPosition = params.getHorizontalPosition;\n this.setHorizontalPosition = params.setHorizontalPosition;\n }\n this.shouldSkipVerticalScroll = params.shouldSkipVerticalScroll || (() => false);\n this.shouldSkipHorizontalScroll = params.shouldSkipHorizontalScroll || (() => false);\n }\n check(mouseEvent, forceSkipVerticalScroll = false) {\n const skipVerticalScroll = forceSkipVerticalScroll || this.shouldSkipVerticalScroll();\n if (skipVerticalScroll && this.shouldSkipHorizontalScroll()) {\n return;\n }\n const rect = this.scrollContainer.getBoundingClientRect();\n const scrollTick = this.scrollByTick;\n this.tickLeft = mouseEvent.clientX < (rect.left + scrollTick);\n this.tickRight = mouseEvent.clientX > (rect.right - scrollTick);\n this.tickUp = mouseEvent.clientY < (rect.top + scrollTick) && !skipVerticalScroll;\n this.tickDown = mouseEvent.clientY > (rect.bottom - scrollTick) && !skipVerticalScroll;\n if (this.tickLeft || this.tickRight || this.tickUp || this.tickDown) {\n this.ensureTickingStarted();\n }\n else {\n this.ensureCleared();\n }\n }\n ensureTickingStarted() {\n if (this.tickingInterval === null) {\n this.tickingInterval = window.setInterval(this.doTick.bind(this), 100);\n this.tickCount = 0;\n }\n }\n doTick() {\n this.tickCount++;\n let tickAmount;\n tickAmount = this.tickCount > 20 ? 200 : (this.tickCount > 10 ? 80 : 40);\n if (this.scrollVertically) {\n const vScrollPosition = this.getVerticalPosition();\n if (this.tickUp) {\n this.setVerticalPosition(vScrollPosition - tickAmount);\n }\n if (this.tickDown) {\n this.setVerticalPosition(vScrollPosition + tickAmount);\n }\n }\n if (this.scrollHorizontally) {\n const hScrollPosition = this.getHorizontalPosition();\n if (this.tickLeft) {\n this.setHorizontalPosition(hScrollPosition - tickAmount);\n }\n if (this.tickRight) {\n this.setHorizontalPosition(hScrollPosition + tickAmount);\n }\n }\n if (this.onScrollCallback) {\n this.onScrollCallback();\n }\n }\n ensureCleared() {\n if (this.tickingInterval) {\n window.clearInterval(this.tickingInterval);\n this.tickingInterval = null;\n }\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { DragAndDropService, DragSourceType, VerticalDirection } from \"../dragAndDrop/dragAndDropService.mjs\";\nimport { Autowired, Optional, PostConstruct } from \"../context/context.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { RowHighlightPosition } from \"../interfaces/iRowNode.mjs\";\nimport { last } from '../utils/array.mjs';\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { missingOrEmpty } from \"../utils/generic.mjs\";\nimport { doOnce } from \"../utils/function.mjs\";\nimport { AutoScrollService } from \"../autoScrollService.mjs\";\nexport class RowDragFeature extends BeanStub {\n constructor(eContainer) {\n super();\n this.isMultiRowDrag = false;\n this.isGridSorted = false;\n this.isGridFiltered = false;\n this.isRowGroupActive = false;\n this.eContainer = eContainer;\n }\n postConstruct() {\n if (this.gridOptionsService.isRowModelType('clientSide')) {\n this.clientSideRowModel = this.rowModel;\n }\n const refreshStatus = () => {\n this.onSortChanged();\n this.onFilterChanged();\n this.onRowGroupChanged();\n };\n this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.onRowGroupChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, () => {\n refreshStatus();\n });\n refreshStatus();\n this.ctrlsService.whenReady(() => {\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n this.autoScrollService = new AutoScrollService({\n scrollContainer: gridBodyCon.getBodyViewportElement(),\n scrollAxis: 'y',\n getVerticalPosition: () => gridBodyCon.getScrollFeature().getVScrollPosition().top,\n setVerticalPosition: (position) => gridBodyCon.getScrollFeature().setVerticalScrollPosition(position),\n onScrollCallback: () => { this.onDragging(this.lastDraggingEvent); }\n });\n });\n }\n onSortChanged() {\n this.isGridSorted = this.sortController.isSortActive();\n }\n onFilterChanged() {\n this.isGridFiltered = this.filterManager.isAnyFilterPresent();\n }\n onRowGroupChanged() {\n const rowGroups = this.columnModel.getRowGroupColumns();\n this.isRowGroupActive = !missingOrEmpty(rowGroups);\n }\n getContainer() {\n return this.eContainer;\n }\n isInterestedIn(type) {\n return type === DragSourceType.RowDrag;\n }\n getIconName() {\n const managedDrag = this.gridOptionsService.is('rowDragManaged');\n if (managedDrag && this.shouldPreventRowMove()) {\n return DragAndDropService.ICON_NOT_ALLOWED;\n }\n return DragAndDropService.ICON_MOVE;\n }\n shouldPreventRowMove() {\n return this.isGridSorted || this.isGridFiltered || this.isRowGroupActive;\n }\n getRowNodes(draggingEvent) {\n if (!this.isFromThisGrid(draggingEvent)) {\n return (draggingEvent.dragItem.rowNodes || []);\n }\n const isRowDragMultiRow = this.gridOptionsService.is('rowDragMultiRow');\n const selectedNodes = [...this.selectionService.getSelectedNodes()].sort((a, b) => {\n if (a.rowIndex == null || b.rowIndex == null) {\n return 0;\n }\n return this.getRowIndexNumber(a) - this.getRowIndexNumber(b);\n });\n const currentNode = draggingEvent.dragItem.rowNode;\n if (isRowDragMultiRow && selectedNodes.indexOf(currentNode) !== -1) {\n this.isMultiRowDrag = true;\n return selectedNodes;\n }\n this.isMultiRowDrag = false;\n return [currentNode];\n }\n onDragEnter(draggingEvent) {\n // builds a lits of all rows being dragged before firing events\n draggingEvent.dragItem.rowNodes = this.getRowNodes(draggingEvent);\n // when entering, we fire the enter event, then in onEnterOrDragging,\n // we also fire the move event. so we get both events when entering.\n this.dispatchGridEvent(Events.EVENT_ROW_DRAG_ENTER, draggingEvent);\n this.getRowNodes(draggingEvent).forEach(rowNode => {\n rowNode.setDragging(true);\n });\n this.onEnterOrDragging(draggingEvent);\n }\n onDragging(draggingEvent) {\n this.onEnterOrDragging(draggingEvent);\n }\n isFromThisGrid(draggingEvent) {\n const { dragSourceDomDataKey } = draggingEvent.dragSource;\n return dragSourceDomDataKey === this.gridOptionsService.getDomDataKey();\n }\n isDropZoneWithinThisGrid(draggingEvent) {\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n const gridGui = gridBodyCon.getGui();\n const { dropZoneTarget } = draggingEvent;\n return !gridGui.contains(dropZoneTarget);\n }\n onEnterOrDragging(draggingEvent) {\n // this event is fired for enter and move\n this.dispatchGridEvent(Events.EVENT_ROW_DRAG_MOVE, draggingEvent);\n this.lastDraggingEvent = draggingEvent;\n const pixel = this.mouseEventService.getNormalisedPosition(draggingEvent).y;\n const managedDrag = this.gridOptionsService.is('rowDragManaged');\n if (managedDrag) {\n this.doManagedDrag(draggingEvent, pixel);\n }\n this.autoScrollService.check(draggingEvent.event);\n }\n doManagedDrag(draggingEvent, pixel) {\n const isFromThisGrid = this.isFromThisGrid(draggingEvent);\n const managedDrag = this.gridOptionsService.is('rowDragManaged');\n const rowNodes = draggingEvent.dragItem.rowNodes;\n if (managedDrag && this.shouldPreventRowMove()) {\n return;\n }\n if (this.gridOptionsService.is('suppressMoveWhenRowDragging') || !isFromThisGrid) {\n if (!this.isDropZoneWithinThisGrid(draggingEvent)) {\n this.clientSideRowModel.highlightRowAtPixel(rowNodes[0], pixel);\n }\n }\n else {\n this.moveRows(rowNodes, pixel);\n }\n }\n getRowIndexNumber(rowNode) {\n return parseInt(last(rowNode.getRowIndexString().split('-')), 10);\n }\n moveRowAndClearHighlight(draggingEvent) {\n const lastHighlightedRowNode = this.clientSideRowModel.getLastHighlightedRowNode();\n const isBelow = lastHighlightedRowNode && lastHighlightedRowNode.highlighted === RowHighlightPosition.Below;\n const pixel = this.mouseEventService.getNormalisedPosition(draggingEvent).y;\n const rowNodes = draggingEvent.dragItem.rowNodes;\n let increment = isBelow ? 1 : 0;\n if (this.isFromThisGrid(draggingEvent)) {\n rowNodes.forEach(rowNode => {\n if (rowNode.rowTop < pixel) {\n increment -= 1;\n }\n });\n this.moveRows(rowNodes, pixel, increment);\n }\n else {\n const getRowIdFunc = this.gridOptionsService.getCallback('getRowId');\n let addIndex = this.clientSideRowModel.getRowIndexAtPixel(pixel) + 1;\n if (this.clientSideRowModel.getHighlightPosition(pixel) === RowHighlightPosition.Above) {\n addIndex--;\n }\n this.clientSideRowModel.updateRowData({\n add: rowNodes\n .map(node => node.data)\n .filter(data => !this.clientSideRowModel.getRowNode(getRowIdFunc ? getRowIdFunc({ data, level: 0 }) : data.id)),\n addIndex\n });\n }\n this.clearRowHighlight();\n }\n clearRowHighlight() {\n this.clientSideRowModel.highlightRowAtPixel(null);\n }\n moveRows(rowNodes, pixel, increment = 0) {\n const rowWasMoved = this.clientSideRowModel.ensureRowsAtPixel(rowNodes, pixel, increment);\n if (rowWasMoved) {\n this.focusService.clearFocusedCell();\n if (this.rangeService) {\n this.rangeService.removeAllCellRanges();\n }\n }\n }\n addRowDropZone(params) {\n if (!params.getContainer()) {\n doOnce(() => console.warn('AG Grid: addRowDropZone - A container target needs to be provided'), 'add-drop-zone-empty-target');\n return;\n }\n if (this.dragAndDropService.findExternalZone(params)) {\n console.warn('AG Grid: addRowDropZone - target already exists in the list of DropZones. Use `removeRowDropZone` before adding it again.');\n return;\n }\n let processedParams = {\n getContainer: params.getContainer\n };\n if (params.fromGrid) {\n params.fromGrid = undefined;\n processedParams = params;\n }\n else {\n if (params.onDragEnter) {\n processedParams.onDragEnter = (e) => {\n params.onDragEnter(this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_ENTER, e));\n };\n }\n if (params.onDragLeave) {\n processedParams.onDragLeave = (e) => {\n params.onDragLeave(this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_LEAVE, e));\n };\n }\n if (params.onDragging) {\n processedParams.onDragging = (e) => {\n params.onDragging(this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_MOVE, e));\n };\n }\n if (params.onDragStop) {\n processedParams.onDragStop = (e) => {\n params.onDragStop(this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_END, e));\n };\n }\n }\n this.dragAndDropService.addDropTarget(Object.assign({ isInterestedIn: (type) => type === DragSourceType.RowDrag, getIconName: () => DragAndDropService.ICON_MOVE, external: true }, processedParams));\n }\n getRowDropZone(events) {\n const getContainer = this.getContainer.bind(this);\n const onDragEnter = this.onDragEnter.bind(this);\n const onDragLeave = this.onDragLeave.bind(this);\n const onDragging = this.onDragging.bind(this);\n const onDragStop = this.onDragStop.bind(this);\n if (!events) {\n return { getContainer, onDragEnter, onDragLeave, onDragging, onDragStop, /* @private */ fromGrid: true };\n }\n return {\n getContainer,\n onDragEnter: events.onDragEnter\n ? ((e) => {\n onDragEnter(e);\n events.onDragEnter(this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_ENTER, e));\n })\n : onDragEnter,\n onDragLeave: events.onDragLeave\n ? ((e) => {\n onDragLeave(e);\n events.onDragLeave(this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_LEAVE, e));\n })\n : onDragLeave,\n onDragging: events.onDragging\n ? ((e) => {\n onDragging(e);\n events.onDragging(this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_MOVE, e));\n })\n : onDragging,\n onDragStop: events.onDragStop\n ? ((e) => {\n onDragStop(e);\n events.onDragStop(this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_END, e));\n })\n : onDragStop,\n fromGrid: true /* @private */\n };\n }\n draggingToRowDragEvent(type, draggingEvent) {\n const yNormalised = this.mouseEventService.getNormalisedPosition(draggingEvent).y;\n const mouseIsPastLastRow = yNormalised > this.paginationProxy.getCurrentPageHeight();\n let overIndex = -1;\n let overNode;\n if (!mouseIsPastLastRow) {\n overIndex = this.rowModel.getRowIndexAtPixel(yNormalised);\n overNode = this.rowModel.getRow(overIndex);\n }\n let vDirectionString;\n switch (draggingEvent.vDirection) {\n case VerticalDirection.Down:\n vDirectionString = 'down';\n break;\n case VerticalDirection.Up:\n vDirectionString = 'up';\n break;\n default:\n vDirectionString = null;\n break;\n }\n const event = {\n type: type,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context,\n event: draggingEvent.event,\n node: draggingEvent.dragItem.rowNode,\n nodes: draggingEvent.dragItem.rowNodes,\n overIndex: overIndex,\n overNode: overNode,\n y: yNormalised,\n vDirection: vDirectionString\n };\n return event;\n }\n dispatchGridEvent(type, draggingEvent) {\n const event = this.draggingToRowDragEvent(type, draggingEvent);\n this.eventService.dispatchEvent(event);\n }\n onDragLeave(draggingEvent) {\n this.dispatchGridEvent(Events.EVENT_ROW_DRAG_LEAVE, draggingEvent);\n this.stopDragging(draggingEvent);\n if (this.gridOptionsService.is('rowDragManaged')) {\n this.clearRowHighlight();\n }\n if (this.isFromThisGrid(draggingEvent)) {\n this.isMultiRowDrag = false;\n }\n }\n onDragStop(draggingEvent) {\n this.dispatchGridEvent(Events.EVENT_ROW_DRAG_END, draggingEvent);\n this.stopDragging(draggingEvent);\n if (this.gridOptionsService.is('rowDragManaged') &&\n (this.gridOptionsService.is('suppressMoveWhenRowDragging') || !this.isFromThisGrid(draggingEvent)) &&\n !this.isDropZoneWithinThisGrid(draggingEvent)) {\n this.moveRowAndClearHighlight(draggingEvent);\n }\n }\n stopDragging(draggingEvent) {\n this.autoScrollService.ensureCleared();\n this.getRowNodes(draggingEvent).forEach(rowNode => {\n rowNode.setDragging(false);\n });\n }\n}\n__decorate([\n Autowired('dragAndDropService')\n], RowDragFeature.prototype, \"dragAndDropService\", void 0);\n__decorate([\n Autowired('rowModel')\n], RowDragFeature.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('paginationProxy')\n], RowDragFeature.prototype, \"paginationProxy\", void 0);\n__decorate([\n Autowired('columnModel')\n], RowDragFeature.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('focusService')\n], RowDragFeature.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('sortController')\n], RowDragFeature.prototype, \"sortController\", void 0);\n__decorate([\n Autowired('filterManager')\n], RowDragFeature.prototype, \"filterManager\", void 0);\n__decorate([\n Autowired('selectionService')\n], RowDragFeature.prototype, \"selectionService\", void 0);\n__decorate([\n Autowired('mouseEventService')\n], RowDragFeature.prototype, \"mouseEventService\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], RowDragFeature.prototype, \"ctrlsService\", void 0);\n__decorate([\n Optional('rangeService')\n], RowDragFeature.prototype, \"rangeService\", void 0);\n__decorate([\n PostConstruct\n], RowDragFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Autowired, Optional } from \"../context/context.mjs\";\nimport { LayoutFeature } from \"../styling/layoutFeature.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { GridBodyScrollFeature } from \"./gridBodyScrollFeature.mjs\";\nimport { getInnerWidth, isElementChildOfClass, isVerticalScrollShowing } from \"../utils/dom.mjs\";\nimport { RowDragFeature } from \"./rowDragFeature.mjs\";\nimport { getTabIndex, isInvisibleScrollbar, isIOSUserAgent } from \"../utils/browser.mjs\";\nimport { TouchListener } from \"../widgets/touchListener.mjs\";\nexport var RowAnimationCssClasses;\n(function (RowAnimationCssClasses) {\n RowAnimationCssClasses[\"ANIMATION_ON\"] = \"ag-row-animation\";\n RowAnimationCssClasses[\"ANIMATION_OFF\"] = \"ag-row-no-animation\";\n})(RowAnimationCssClasses || (RowAnimationCssClasses = {}));\nexport const CSS_CLASS_FORCE_VERTICAL_SCROLL = 'ag-force-vertical-scroll';\nconst CSS_CLASS_CELL_SELECTABLE = 'ag-selectable';\nconst CSS_CLASS_COLUMN_MOVING = 'ag-column-moving';\nexport class GridBodyCtrl extends BeanStub {\n constructor() {\n super(...arguments);\n this.stickyTopHeight = 0;\n }\n getScrollFeature() {\n return this.bodyScrollFeature;\n }\n getBodyViewportElement() {\n return this.eBodyViewport;\n }\n setComp(comp, eGridBody, eBodyViewport, eTop, eBottom, eStickyTop) {\n this.comp = comp;\n this.eGridBody = eGridBody;\n this.eBodyViewport = eBodyViewport;\n this.eTop = eTop;\n this.eBottom = eBottom;\n this.eStickyTop = eStickyTop;\n this.setCellTextSelection(this.gridOptionsService.is('enableCellTextSelection'));\n this.createManagedBean(new LayoutFeature(this.comp));\n this.bodyScrollFeature = this.createManagedBean(new GridBodyScrollFeature(this.eBodyViewport));\n this.addRowDragListener();\n this.setupRowAnimationCssClass();\n this.addEventListeners();\n this.addFocusListeners([eTop, eBodyViewport, eBottom, eStickyTop]);\n this.onGridColumnsChanged();\n this.addBodyViewportListener();\n this.setFloatingHeights();\n this.disableBrowserDragging();\n this.addStopEditingWhenGridLosesFocus();\n this.filterManager.setupAdvancedFilterHeaderComp(eTop);\n this.ctrlsService.registerGridBodyCtrl(this);\n }\n getComp() {\n return this.comp;\n }\n addEventListeners() {\n this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.onGridColumnsChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, this.onScrollVisibilityChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_PINNED_ROW_DATA_CHANGED, this.onPinnedRowDataChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_HEADER_HEIGHT_CHANGED, this.onHeaderHeightChanged.bind(this));\n }\n addFocusListeners(elements) {\n elements.forEach(element => {\n this.addManagedListener(element, 'focusin', (e) => {\n const { target } = e;\n // element being focused is nested?\n const isFocusedElementNested = isElementChildOfClass(target, 'ag-root', element);\n element.classList.toggle('ag-has-focus', !isFocusedElementNested);\n });\n this.addManagedListener(element, 'focusout', (e) => {\n const { target, relatedTarget } = e;\n const gridContainRelatedTarget = element.contains(relatedTarget);\n const isNestedRelatedTarget = isElementChildOfClass(relatedTarget, 'ag-root', element);\n const isNestedTarget = isElementChildOfClass(target, 'ag-root', element);\n // element losing focus belongs to a nested grid,\n // it should not be handled here.\n if (isNestedTarget) {\n return;\n }\n // the grid does not contain, or the focus element is within\n // a nested grid\n if (!gridContainRelatedTarget || isNestedRelatedTarget) {\n element.classList.remove('ag-has-focus');\n }\n });\n });\n }\n // used by ColumnAnimationService\n setColumnMovingCss(moving) {\n this.comp.setColumnMovingCss(CSS_CLASS_COLUMN_MOVING, moving);\n }\n setCellTextSelection(selectable = false) {\n this.comp.setCellSelectableCss(CSS_CLASS_CELL_SELECTABLE, selectable);\n }\n onScrollVisibilityChanged() {\n const visible = this.scrollVisibleService.isVerticalScrollShowing();\n this.setVerticalScrollPaddingVisible(visible);\n this.setStickyTopWidth(visible);\n const scrollbarWidth = visible ? (this.gridOptionsService.getScrollbarWidth() || 0) : 0;\n const pad = isInvisibleScrollbar() ? 16 : 0;\n const width = `calc(100% + ${scrollbarWidth + pad}px)`;\n this.animationFrameService.requestAnimationFrame(() => this.comp.setBodyViewportWidth(width));\n }\n onGridColumnsChanged() {\n const columns = this.columnModel.getAllGridColumns();\n this.comp.setColumnCount(columns ? columns.length : 0);\n }\n // if we do not do this, then the user can select a pic in the grid (eg an image in a custom cell renderer)\n // and then that will start the browser native drag n' drop, which messes up with our own drag and drop.\n disableBrowserDragging() {\n this.addManagedListener(this.eGridBody, 'dragstart', (event) => {\n if (event.target instanceof HTMLImageElement) {\n event.preventDefault();\n return false;\n }\n });\n }\n addStopEditingWhenGridLosesFocus() {\n if (!this.gridOptionsService.is('stopEditingWhenCellsLoseFocus')) {\n return;\n }\n const focusOutListener = (event) => {\n // this is the element the focus is moving to\n const elementWithFocus = event.relatedTarget;\n if (getTabIndex(elementWithFocus) === null) {\n this.rowRenderer.stopEditing();\n return;\n }\n let clickInsideGrid = \n // see if click came from inside the viewports\n viewports.some(viewport => viewport.contains(elementWithFocus))\n // and also that it's not from a detail grid\n && this.mouseEventService.isElementInThisGrid(elementWithFocus);\n if (!clickInsideGrid) {\n const popupService = this.popupService;\n clickInsideGrid =\n popupService.getActivePopups().some(popup => popup.contains(elementWithFocus)) ||\n popupService.isElementWithinCustomPopup(elementWithFocus);\n }\n if (!clickInsideGrid) {\n this.rowRenderer.stopEditing();\n }\n };\n const viewports = [this.eBodyViewport, this.eBottom, this.eTop, this.eStickyTop];\n viewports.forEach(viewport => this.addManagedListener(viewport, 'focusout', focusOutListener));\n }\n updateRowCount() {\n const headerCount = this.headerNavigationService.getHeaderRowCount() + this.filterManager.getHeaderRowCount();\n const rowCount = this.rowModel.isLastRowIndexKnown() ? this.rowModel.getRowCount() : -1;\n const total = rowCount === -1 ? -1 : (headerCount + rowCount);\n this.comp.setRowCount(total);\n }\n registerBodyViewportResizeListener(listener) {\n this.comp.registerBodyViewportResizeListener(listener);\n }\n setVerticalScrollPaddingVisible(visible) {\n const overflowY = visible ? 'scroll' : 'hidden';\n this.comp.setPinnedTopBottomOverflowY(overflowY);\n }\n isVerticalScrollShowing() {\n const show = this.gridOptionsService.is('alwaysShowVerticalScroll');\n const cssClass = show ? CSS_CLASS_FORCE_VERTICAL_SCROLL : null;\n const allowVerticalScroll = this.gridOptionsService.isDomLayout('normal');\n this.comp.setAlwaysVerticalScrollClass(cssClass, show);\n return show || (allowVerticalScroll && isVerticalScrollShowing(this.eBodyViewport));\n }\n setupRowAnimationCssClass() {\n const listener = () => {\n // we don't want to use row animation if scaling, as rows jump strangely as you scroll,\n // when scaling and doing row animation.\n const animateRows = this.gridOptionsService.isAnimateRows() && !this.rowContainerHeightService.isStretching();\n const animateRowsCssClass = animateRows ? RowAnimationCssClasses.ANIMATION_ON : RowAnimationCssClasses.ANIMATION_OFF;\n this.comp.setRowAnimationCssOnBodyViewport(animateRowsCssClass, animateRows);\n };\n listener();\n this.addManagedListener(this.eventService, Events.EVENT_HEIGHT_SCALE_CHANGED, listener);\n this.addManagedPropertyListener('animateRows', listener);\n }\n getGridBodyElement() {\n return this.eGridBody;\n }\n addBodyViewportListener() {\n // we want to listen for clicks directly on the eBodyViewport, so the user has a way of showing\n // the context menu if no rows or columns are displayed, or user simply clicks outside of a cell\n const listener = this.onBodyViewportContextMenu.bind(this);\n this.addManagedListener(this.eBodyViewport, 'contextmenu', listener);\n this.mockContextMenuForIPad(listener);\n this.addManagedListener(this.eBodyViewport, 'wheel', this.onBodyViewportWheel.bind(this));\n this.addManagedListener(this.eStickyTop, 'wheel', this.onStickyTopWheel.bind(this));\n // allow mouseWheel on the Full Width Container to Scroll the Viewport\n this.addFullWidthContainerWheelListener();\n }\n addFullWidthContainerWheelListener() {\n const fullWidthContainer = this.eBodyViewport.querySelector('.ag-full-width-container');\n const eCenterColsViewport = this.eBodyViewport.querySelector('.ag-center-cols-viewport');\n if (fullWidthContainer && eCenterColsViewport) {\n this.addManagedListener(fullWidthContainer, 'wheel', (e) => this.onFullWidthContainerWheel(e, eCenterColsViewport));\n }\n }\n onFullWidthContainerWheel(e, eCenterColsViewport) {\n if (!e.deltaX ||\n Math.abs(e.deltaY) > Math.abs(e.deltaX) ||\n !this.mouseEventService.isEventFromThisGrid(e)) {\n return;\n }\n e.preventDefault();\n eCenterColsViewport.scrollBy({ left: e.deltaX });\n }\n onBodyViewportContextMenu(mouseEvent, touch, touchEvent) {\n if (!mouseEvent && !touchEvent) {\n return;\n }\n if (this.gridOptionsService.is('preventDefaultOnContextMenu')) {\n const event = (mouseEvent || touchEvent);\n event.preventDefault();\n }\n const { target } = (mouseEvent || touch);\n if (target === this.eBodyViewport || target === this.ctrlsService.getCenterRowContainerCtrl().getViewportElement()) {\n // show it\n if (!this.contextMenuFactory) {\n return;\n }\n if (mouseEvent) {\n this.contextMenuFactory.onContextMenu(mouseEvent, null, null, null, null, this.eGridBody);\n }\n else if (touchEvent) {\n this.contextMenuFactory.onContextMenu(null, touchEvent, null, null, null, this.eGridBody);\n }\n }\n }\n mockContextMenuForIPad(listener) {\n // we do NOT want this when not in iPad\n if (!isIOSUserAgent()) {\n return;\n }\n const touchListener = new TouchListener(this.eBodyViewport);\n const longTapListener = (event) => {\n listener(undefined, event.touchStart, event.touchEvent);\n };\n this.addManagedListener(touchListener, TouchListener.EVENT_LONG_TAP, longTapListener);\n this.addDestroyFunc(() => touchListener.destroy());\n }\n onBodyViewportWheel(e) {\n if (!this.gridOptionsService.is('suppressScrollWhenPopupsAreOpen')) {\n return;\n }\n if (this.popupService.hasAnchoredPopup()) {\n e.preventDefault();\n }\n }\n onStickyTopWheel(e) {\n e.preventDefault();\n if (e.offsetY) {\n this.scrollVertically(e.deltaY);\n }\n }\n getGui() {\n return this.eGridBody;\n }\n // called by rowDragFeature\n scrollVertically(pixels) {\n const oldScrollPosition = this.eBodyViewport.scrollTop;\n this.bodyScrollFeature.setVerticalScrollPosition(oldScrollPosition + pixels);\n return this.eBodyViewport.scrollTop - oldScrollPosition;\n }\n addRowDragListener() {\n this.rowDragFeature = this.createManagedBean(new RowDragFeature(this.eBodyViewport));\n this.dragAndDropService.addDropTarget(this.rowDragFeature);\n }\n getRowDragFeature() {\n return this.rowDragFeature;\n }\n onPinnedRowDataChanged() {\n this.setFloatingHeights();\n }\n setFloatingHeights() {\n const { pinnedRowModel } = this;\n let floatingTopHeight = pinnedRowModel.getPinnedTopTotalHeight();\n if (floatingTopHeight) {\n // adding 1px for cell bottom border\n floatingTopHeight += 1;\n }\n let floatingBottomHeight = pinnedRowModel.getPinnedBottomTotalHeight();\n if (floatingBottomHeight) {\n // adding 1px for cell bottom border\n floatingBottomHeight += 1;\n }\n this.comp.setTopHeight(floatingTopHeight);\n this.comp.setBottomHeight(floatingBottomHeight);\n this.comp.setTopDisplay(floatingTopHeight ? 'inherit' : 'none');\n this.comp.setBottomDisplay(floatingBottomHeight ? 'inherit' : 'none');\n this.setStickyTopOffsetTop();\n }\n setStickyTopHeight(height = 0) {\n // console.log('setting sticky top height ' + height);\n this.comp.setStickyTopHeight(`${height}px`);\n this.stickyTopHeight = height;\n }\n getStickyTopHeight() {\n return this.stickyTopHeight;\n }\n setStickyTopWidth(vScrollVisible) {\n if (!vScrollVisible) {\n this.comp.setStickyTopWidth('100%');\n }\n else {\n const scrollbarWidth = this.gridOptionsService.getScrollbarWidth();\n this.comp.setStickyTopWidth(`calc(100% - ${scrollbarWidth}px)`);\n }\n }\n onHeaderHeightChanged() {\n this.setStickyTopOffsetTop();\n }\n setStickyTopOffsetTop() {\n const headerCtrl = this.ctrlsService.getGridHeaderCtrl();\n const headerHeight = headerCtrl.getHeaderHeight() + this.filterManager.getHeaderHeight();\n const pinnedTopHeight = this.pinnedRowModel.getPinnedTopTotalHeight();\n let height = 0;\n if (headerHeight > 0) {\n height += headerHeight + 1;\n }\n if (pinnedTopHeight > 0) {\n height += pinnedTopHeight + 1;\n }\n this.comp.setStickyTopTop(`${height}px`);\n }\n // method will call itself if no available width. this covers if the grid\n // isn't visible, but is just about to be visible.\n sizeColumnsToFit(params, nextTimeout) {\n const removeScrollWidth = this.isVerticalScrollShowing();\n const scrollWidthToRemove = removeScrollWidth ? this.gridOptionsService.getScrollbarWidth() : 0;\n // bodyViewportWidth should be calculated from eGridBody, not eBodyViewport\n // because we change the width of the bodyViewport to hide the real browser scrollbar\n const bodyViewportWidth = getInnerWidth(this.eGridBody);\n const availableWidth = bodyViewportWidth - scrollWidthToRemove;\n if (availableWidth > 0) {\n this.columnModel.sizeColumnsToFit(availableWidth, \"sizeColumnsToFit\", false, params);\n return;\n }\n if (nextTimeout === undefined) {\n window.setTimeout(() => {\n this.sizeColumnsToFit(params, 100);\n }, 0);\n }\n else if (nextTimeout === 100) {\n window.setTimeout(() => {\n this.sizeColumnsToFit(params, 500);\n }, 100);\n }\n else if (nextTimeout === 500) {\n window.setTimeout(() => {\n this.sizeColumnsToFit(params, -1);\n }, 500);\n }\n else {\n console.warn('AG Grid: tried to call sizeColumnsToFit() but the grid is coming back with ' +\n 'zero width, maybe the grid is not visible yet on the screen?');\n }\n }\n // + rangeService\n addScrollEventListener(listener) {\n this.eBodyViewport.addEventListener('scroll', listener, { passive: true });\n }\n // + focusService\n removeScrollEventListener(listener) {\n this.eBodyViewport.removeEventListener('scroll', listener);\n }\n}\n__decorate([\n Autowired('animationFrameService')\n], GridBodyCtrl.prototype, \"animationFrameService\", void 0);\n__decorate([\n Autowired('rowContainerHeightService')\n], GridBodyCtrl.prototype, \"rowContainerHeightService\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], GridBodyCtrl.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('columnModel')\n], GridBodyCtrl.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('scrollVisibleService')\n], GridBodyCtrl.prototype, \"scrollVisibleService\", void 0);\n__decorate([\n Optional('contextMenuFactory')\n], GridBodyCtrl.prototype, \"contextMenuFactory\", void 0);\n__decorate([\n Autowired('headerNavigationService')\n], GridBodyCtrl.prototype, \"headerNavigationService\", void 0);\n__decorate([\n Autowired('dragAndDropService')\n], GridBodyCtrl.prototype, \"dragAndDropService\", void 0);\n__decorate([\n Autowired('pinnedRowModel')\n], GridBodyCtrl.prototype, \"pinnedRowModel\", void 0);\n__decorate([\n Autowired('rowRenderer')\n], GridBodyCtrl.prototype, \"rowRenderer\", void 0);\n__decorate([\n Autowired('popupService')\n], GridBodyCtrl.prototype, \"popupService\", void 0);\n__decorate([\n Autowired('mouseEventService')\n], GridBodyCtrl.prototype, \"mouseEventService\", void 0);\n__decorate([\n Autowired('rowModel')\n], GridBodyCtrl.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('filterManager')\n], GridBodyCtrl.prototype, \"filterManager\", void 0);\n","export var SelectionHandleType;\n(function (SelectionHandleType) {\n SelectionHandleType[SelectionHandleType[\"FILL\"] = 0] = \"FILL\";\n SelectionHandleType[SelectionHandleType[\"RANGE\"] = 1] = \"RANGE\";\n})(SelectionHandleType || (SelectionHandleType = {}));\nexport var CellRangeType;\n(function (CellRangeType) {\n CellRangeType[CellRangeType[\"VALUE\"] = 0] = \"VALUE\";\n CellRangeType[CellRangeType[\"DIMENSION\"] = 1] = \"DIMENSION\";\n})(CellRangeType || (CellRangeType = {}));\n","import { includes, last } from \"../../utils/array.mjs\";\nimport { CellRangeType, SelectionHandleType } from \"../../interfaces/IRangeService.mjs\";\nimport { missing } from \"../../utils/generic.mjs\";\nimport { setAriaSelected } from \"../../utils/aria.mjs\";\nconst CSS_CELL_RANGE_SELECTED = 'ag-cell-range-selected';\nconst CSS_CELL_RANGE_CHART = 'ag-cell-range-chart';\nconst CSS_CELL_RANGE_SINGLE_CELL = 'ag-cell-range-single-cell';\nconst CSS_CELL_RANGE_CHART_CATEGORY = 'ag-cell-range-chart-category';\nconst CSS_CELL_RANGE_HANDLE = 'ag-cell-range-handle';\nconst CSS_CELL_RANGE_TOP = 'ag-cell-range-top';\nconst CSS_CELL_RANGE_RIGHT = 'ag-cell-range-right';\nconst CSS_CELL_RANGE_BOTTOM = 'ag-cell-range-bottom';\nconst CSS_CELL_RANGE_LEFT = 'ag-cell-range-left';\nexport class CellRangeFeature {\n constructor(beans, ctrl) {\n this.beans = beans;\n this.cellCtrl = ctrl;\n }\n setComp(cellComp, eGui) {\n this.cellComp = cellComp;\n this.eGui = eGui;\n this.onRangeSelectionChanged();\n }\n onRangeSelectionChanged() {\n // when using reactUi, given UI is async, it's possible this method is called before the comp is registered\n if (!this.cellComp) {\n return;\n }\n this.rangeCount = this.beans.rangeService.getCellRangeCount(this.cellCtrl.getCellPosition());\n this.hasChartRange = this.getHasChartRange();\n this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED, this.rangeCount !== 0);\n this.cellComp.addOrRemoveCssClass(`${CSS_CELL_RANGE_SELECTED}-1`, this.rangeCount === 1);\n this.cellComp.addOrRemoveCssClass(`${CSS_CELL_RANGE_SELECTED}-2`, this.rangeCount === 2);\n this.cellComp.addOrRemoveCssClass(`${CSS_CELL_RANGE_SELECTED}-3`, this.rangeCount === 3);\n this.cellComp.addOrRemoveCssClass(`${CSS_CELL_RANGE_SELECTED}-4`, this.rangeCount >= 4);\n this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_CHART, this.hasChartRange);\n setAriaSelected(this.eGui, this.rangeCount > 0 ? true : undefined);\n this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SINGLE_CELL, this.isSingleCell());\n this.updateRangeBorders();\n this.refreshHandle();\n }\n updateRangeBorders() {\n const rangeBorders = this.getRangeBorders();\n const isSingleCell = this.isSingleCell();\n const isTop = !isSingleCell && rangeBorders.top;\n const isRight = !isSingleCell && rangeBorders.right;\n const isBottom = !isSingleCell && rangeBorders.bottom;\n const isLeft = !isSingleCell && rangeBorders.left;\n this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_TOP, isTop);\n this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_RIGHT, isRight);\n this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_BOTTOM, isBottom);\n this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_LEFT, isLeft);\n }\n isSingleCell() {\n const { rangeService } = this.beans;\n return this.rangeCount === 1 && rangeService && !rangeService.isMoreThanOneCell();\n }\n getHasChartRange() {\n const { rangeService } = this.beans;\n if (!this.rangeCount || !rangeService) {\n return false;\n }\n const cellRanges = rangeService.getCellRanges();\n return cellRanges.length > 0 && cellRanges.every(range => includes([CellRangeType.DIMENSION, CellRangeType.VALUE], range.type));\n }\n updateRangeBordersIfRangeCount() {\n // we only need to update range borders if we are in a range\n if (this.rangeCount > 0) {\n this.updateRangeBorders();\n this.refreshHandle();\n }\n }\n getRangeBorders() {\n const isRtl = this.beans.gridOptionsService.is('enableRtl');\n let top = false;\n let right = false;\n let bottom = false;\n let left = false;\n const thisCol = this.cellCtrl.getCellPosition().column;\n const { rangeService, columnModel } = this.beans;\n let leftCol;\n let rightCol;\n if (isRtl) {\n leftCol = columnModel.getDisplayedColAfter(thisCol);\n rightCol = columnModel.getDisplayedColBefore(thisCol);\n }\n else {\n leftCol = columnModel.getDisplayedColBefore(thisCol);\n rightCol = columnModel.getDisplayedColAfter(thisCol);\n }\n const ranges = rangeService.getCellRanges().filter(range => rangeService.isCellInSpecificRange(this.cellCtrl.getCellPosition(), range));\n // this means we are the first column in the grid\n if (!leftCol) {\n left = true;\n }\n // this means we are the last column in the grid\n if (!rightCol) {\n right = true;\n }\n for (let i = 0; i < ranges.length; i++) {\n if (top && right && bottom && left) {\n break;\n }\n const range = ranges[i];\n const startRow = rangeService.getRangeStartRow(range);\n const endRow = rangeService.getRangeEndRow(range);\n if (!top && this.beans.rowPositionUtils.sameRow(startRow, this.cellCtrl.getCellPosition())) {\n top = true;\n }\n if (!bottom && this.beans.rowPositionUtils.sameRow(endRow, this.cellCtrl.getCellPosition())) {\n bottom = true;\n }\n if (!left && leftCol && range.columns.indexOf(leftCol) < 0) {\n left = true;\n }\n if (!right && rightCol && range.columns.indexOf(rightCol) < 0) {\n right = true;\n }\n }\n return { top, right, bottom, left };\n }\n refreshHandle() {\n if (!this.beans.rangeService) {\n return;\n }\n const shouldHaveSelectionHandle = this.shouldHaveSelectionHandle();\n if (this.selectionHandle && !shouldHaveSelectionHandle) {\n this.selectionHandle = this.beans.context.destroyBean(this.selectionHandle);\n }\n if (shouldHaveSelectionHandle) {\n this.addSelectionHandle();\n }\n this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_HANDLE, !!this.selectionHandle);\n }\n shouldHaveSelectionHandle() {\n const { gridOptionsService, rangeService } = this.beans;\n const cellRanges = rangeService.getCellRanges();\n const rangesLen = cellRanges.length;\n if (this.rangeCount < 1 || rangesLen < 1) {\n return false;\n }\n const cellRange = last(cellRanges);\n const cellPosition = this.cellCtrl.getCellPosition();\n const isFillHandleAvailable = gridOptionsService.is('enableFillHandle') && !this.cellCtrl.isSuppressFillHandle();\n const isRangeHandleAvailable = gridOptionsService.is('enableRangeHandle');\n let handleIsAvailable = rangesLen === 1 && !this.cellCtrl.isEditing() && (isFillHandleAvailable || isRangeHandleAvailable);\n if (this.hasChartRange) {\n const hasCategoryRange = cellRanges[0].type === CellRangeType.DIMENSION;\n const isCategoryCell = hasCategoryRange && rangeService.isCellInSpecificRange(cellPosition, cellRanges[0]);\n this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_CHART_CATEGORY, isCategoryCell);\n handleIsAvailable = cellRange.type === CellRangeType.VALUE;\n }\n return handleIsAvailable &&\n cellRange.endRow != null &&\n rangeService.isContiguousRange(cellRange) &&\n rangeService.isBottomRightCell(cellRange, cellPosition);\n }\n addSelectionHandle() {\n const { gridOptionsService, rangeService } = this.beans;\n const cellRangeType = last(rangeService.getCellRanges()).type;\n const selectionHandleFill = gridOptionsService.is('enableFillHandle') && missing(cellRangeType);\n const type = selectionHandleFill ? SelectionHandleType.FILL : SelectionHandleType.RANGE;\n if (this.selectionHandle && this.selectionHandle.getType() !== type) {\n this.selectionHandle = this.beans.context.destroyBean(this.selectionHandle);\n }\n if (!this.selectionHandle) {\n this.selectionHandle = this.beans.selectionHandleFactory.createSelectionHandle(type);\n }\n this.selectionHandle.refresh(this.cellCtrl);\n }\n destroy() {\n this.beans.context.destroyBean(this.selectionHandle);\n }\n}\n","import { areEqual, last } from \"../../utils/array.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nimport { missing } from \"../../utils/generic.mjs\";\nimport { BeanStub } from \"../../context/beanStub.mjs\";\n/**\n * Takes care of:\n * #) Cell Width (including when doing cell spanning, which makes width cover many columns)\n * #) Cell Height (when doing row span, otherwise we don't touch the height as it's just row height)\n * #) Cell Left (the horizontal positioning of the cell, the vertical positioning is on the row)\n */\nexport class CellPositionFeature extends BeanStub {\n constructor(ctrl, beans) {\n super();\n this.cellCtrl = ctrl;\n this.beans = beans;\n this.column = ctrl.getColumn();\n this.rowNode = ctrl.getRowNode();\n this.setupColSpan();\n this.setupRowSpan();\n }\n setupRowSpan() {\n this.rowSpan = this.column.getRowSpan(this.rowNode);\n }\n setComp(eGui) {\n this.eGui = eGui;\n this.onLeftChanged();\n this.onWidthChanged();\n this.applyRowSpan();\n }\n onDisplayColumnsChanged() {\n const colsSpanning = this.getColSpanningList();\n if (!areEqual(this.colsSpanning, colsSpanning)) {\n this.colsSpanning = colsSpanning;\n this.onWidthChanged();\n this.onLeftChanged(); // left changes when doing RTL\n }\n }\n setupColSpan() {\n // if no col span is active, then we don't set it up, as it would be wasteful of CPU\n if (this.column.getColDef().colSpan == null) {\n return;\n }\n this.colsSpanning = this.getColSpanningList();\n // because we are col spanning, a reorder of the cols can change what cols we are spanning over\n this.addManagedListener(this.beans.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayColumnsChanged.bind(this));\n // because we are spanning over multiple cols, we check for width any time any cols width changes.\n // this is expensive - really we should be explicitly checking only the cols we are spanning over\n // instead of every col, however it would be tricky code to track the cols we are spanning over, so\n // because hardly anyone will be using colSpan, am favouring this easier way for more maintainable code.\n this.addManagedListener(this.beans.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onWidthChanged.bind(this));\n }\n onWidthChanged() {\n if (!this.eGui) {\n return;\n }\n const width = this.getCellWidth();\n this.eGui.style.width = `${width}px`;\n }\n getCellWidth() {\n if (!this.colsSpanning) {\n return this.column.getActualWidth();\n }\n return this.colsSpanning.reduce((width, col) => width + col.getActualWidth(), 0);\n }\n getColSpanningList() {\n const colSpan = this.column.getColSpan(this.rowNode);\n const colsSpanning = [];\n // if just one col, the col span is just the column we are in\n if (colSpan === 1) {\n colsSpanning.push(this.column);\n }\n else {\n let pointer = this.column;\n const pinned = this.column.getPinned();\n for (let i = 0; pointer && i < colSpan; i++) {\n colsSpanning.push(pointer);\n pointer = this.beans.columnModel.getDisplayedColAfter(pointer);\n if (!pointer || missing(pointer)) {\n break;\n }\n // we do not allow col spanning to span outside of pinned areas\n if (pinned !== pointer.getPinned()) {\n break;\n }\n }\n }\n return colsSpanning;\n }\n onLeftChanged() {\n if (!this.eGui) {\n return;\n }\n const left = this.modifyLeftForPrintLayout(this.getCellLeft());\n this.eGui.style.left = left + 'px';\n }\n getCellLeft() {\n let mostLeftCol;\n if (this.beans.gridOptionsService.is('enableRtl') && this.colsSpanning) {\n mostLeftCol = last(this.colsSpanning);\n }\n else {\n mostLeftCol = this.column;\n }\n return mostLeftCol.getLeft();\n }\n modifyLeftForPrintLayout(leftPosition) {\n if (!this.cellCtrl.isPrintLayout() || this.column.getPinned() === 'left') {\n return leftPosition;\n }\n const leftWidth = this.beans.columnModel.getDisplayedColumnsLeftWidth();\n if (this.column.getPinned() === 'right') {\n const bodyWidth = this.beans.columnModel.getBodyContainerWidth();\n return leftWidth + bodyWidth + (leftPosition || 0);\n }\n // is in body\n return leftWidth + (leftPosition || 0);\n }\n applyRowSpan() {\n if (this.rowSpan === 1) {\n return;\n }\n const singleRowHeight = this.beans.gridOptionsService.getRowHeightAsNumber();\n const totalRowHeight = singleRowHeight * this.rowSpan;\n this.eGui.style.height = `${totalRowHeight}px`;\n this.eGui.style.zIndex = '1';\n }\n // overriding to make public, as we don't dispose this bean via context\n destroy() {\n super.destroy();\n }\n}\n","import { BeanStub } from \"../../context/beanStub.mjs\";\nexport class CellCustomStyleFeature extends BeanStub {\n constructor(ctrl, beans) {\n super();\n this.staticClasses = [];\n this.cellCtrl = ctrl;\n this.beans = beans;\n this.column = ctrl.getColumn();\n this.rowNode = ctrl.getRowNode();\n }\n setComp(comp) {\n this.cellComp = comp;\n this.applyUserStyles();\n this.applyCellClassRules();\n this.applyClassesFromColDef();\n }\n applyCellClassRules() {\n const colDef = this.column.getColDef();\n const cellClassParams = {\n value: this.cellCtrl.getValue(),\n data: this.rowNode.data,\n node: this.rowNode,\n colDef: colDef,\n column: this.column,\n rowIndex: this.rowNode.rowIndex,\n api: this.beans.gridOptionsService.api,\n columnApi: this.beans.gridOptionsService.columnApi,\n context: this.beans.gridOptionsService.context\n };\n this.beans.stylingService.processClassRules(colDef.cellClassRules, cellClassParams, className => this.cellComp.addOrRemoveCssClass(className, true), className => this.cellComp.addOrRemoveCssClass(className, false));\n }\n applyUserStyles() {\n const colDef = this.column.getColDef();\n if (!colDef.cellStyle) {\n return;\n }\n let styles;\n if (typeof colDef.cellStyle === 'function') {\n const cellStyleParams = {\n column: this.column,\n value: this.cellCtrl.getValue(),\n colDef: colDef,\n data: this.rowNode.data,\n node: this.rowNode,\n rowIndex: this.rowNode.rowIndex,\n api: this.beans.gridOptionsService.api,\n columnApi: this.beans.gridOptionsService.columnApi,\n context: this.beans.gridOptionsService.context,\n };\n const cellStyleFunc = colDef.cellStyle;\n styles = cellStyleFunc(cellStyleParams);\n }\n else {\n styles = colDef.cellStyle;\n }\n if (styles) {\n this.cellComp.setUserStyles(styles);\n }\n }\n applyClassesFromColDef() {\n const colDef = this.column.getColDef();\n const cellClassParams = {\n value: this.cellCtrl.getValue(),\n data: this.rowNode.data,\n node: this.rowNode,\n column: this.column,\n colDef: colDef,\n rowIndex: this.rowNode.rowIndex,\n api: this.beans.gridOptionsService.api,\n columnApi: this.beans.gridOptionsService.columnApi,\n context: this.beans.gridOptionsService.context\n };\n if (this.staticClasses.length) {\n this.staticClasses.forEach(className => this.cellComp.addOrRemoveCssClass(className, false));\n }\n this.staticClasses = this.beans.stylingService.getStaticCellClasses(colDef, cellClassParams);\n if (this.staticClasses.length) {\n this.staticClasses.forEach(className => this.cellComp.addOrRemoveCssClass(className, true));\n }\n }\n // overriding to make public, as we don't dispose this bean via context\n destroy() {\n super.destroy();\n }\n}\n","import { BeanStub } from \"../context/beanStub.mjs\";\nimport { CustomTooltipFeature } from \"./customTooltipFeature.mjs\";\nexport class TooltipFeature extends BeanStub {\n constructor(ctrl, beans) {\n super();\n this.ctrl = ctrl;\n this.beans = beans;\n }\n setComp(eGui) {\n this.eGui = eGui;\n this.setupTooltip();\n }\n setBrowserTooltip(tooltip) {\n const name = 'title';\n if (tooltip != null && tooltip != '') {\n this.eGui.setAttribute(name, tooltip);\n }\n else {\n this.eGui.removeAttribute(name);\n }\n }\n setupTooltip() {\n this.browserTooltips = this.beans.gridOptionsService.is('enableBrowserTooltips');\n this.updateTooltipText();\n if (this.browserTooltips) {\n this.setBrowserTooltip(this.tooltip);\n }\n else {\n this.createTooltipFeatureIfNeeded();\n }\n }\n updateTooltipText() {\n this.tooltip = this.ctrl.getTooltipValue();\n }\n createTooltipFeatureIfNeeded() {\n if (this.genericTooltipFeature != null) {\n return;\n }\n const parent = {\n getTooltipParams: () => this.getTooltipParams(),\n getGui: () => this.ctrl.getGui()\n };\n this.genericTooltipFeature = this.createManagedBean(new CustomTooltipFeature(parent), this.beans.context);\n }\n refreshToolTip() {\n this.updateTooltipText();\n if (this.browserTooltips) {\n this.setBrowserTooltip(this.tooltip);\n }\n }\n getTooltipParams() {\n const ctrl = this.ctrl;\n const column = ctrl.getColumn ? ctrl.getColumn() : undefined;\n const colDef = ctrl.getColDef ? ctrl.getColDef() : undefined;\n const rowNode = ctrl.getRowNode ? ctrl.getRowNode() : undefined;\n return {\n location: ctrl.getLocation(),\n colDef: colDef,\n column: column,\n rowIndex: ctrl.getRowIndex ? ctrl.getRowIndex() : undefined,\n node: rowNode,\n data: rowNode ? rowNode.data : undefined,\n value: this.getTooltipText(),\n valueFormatted: ctrl.getValueFormatted ? ctrl.getValueFormatted() : undefined,\n hideTooltipCallback: () => this.genericTooltipFeature.hideTooltip(true)\n };\n }\n getTooltipText() {\n return this.tooltip;\n }\n // overriding to make public, as we don't dispose this bean via context\n destroy() {\n super.destroy();\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, Optional, PostConstruct } from \"../context/context.mjs\";\n/** Using the IoC has a slight performance consideration, which is no problem most of the\n * time, unless we are trashing objects - which is the case when scrolling and rowComp\n * and cellComp. So for performance reasons, RowComp and CellComp do not get autowired\n * with the IoC. Instead they get passed this object which is all the beans the RowComp\n * and CellComp need. Not autowiring all the cells gives performance improvement. */\nlet Beans = class Beans {\n postConstruct() {\n this.doingMasterDetail = this.gridOptionsService.isMasterDetail();\n if (this.gridOptionsService.isRowModelType('clientSide')) {\n this.clientSideRowModel = this.rowModel;\n }\n if (this.gridOptionsService.isRowModelType('serverSide')) {\n this.serverSideRowModel = this.rowModel;\n }\n }\n};\n__decorate([\n Autowired('resizeObserverService')\n], Beans.prototype, \"resizeObserverService\", void 0);\n__decorate([\n Autowired('paginationProxy')\n], Beans.prototype, \"paginationProxy\", void 0);\n__decorate([\n Autowired('context')\n], Beans.prototype, \"context\", void 0);\n__decorate([\n Autowired('columnApi')\n], Beans.prototype, \"columnApi\", void 0);\n__decorate([\n Autowired('gridApi')\n], Beans.prototype, \"gridApi\", void 0);\n__decorate([\n Autowired('gridOptionsService')\n], Beans.prototype, \"gridOptionsService\", void 0);\n__decorate([\n Autowired('expressionService')\n], Beans.prototype, \"expressionService\", void 0);\n__decorate([\n Autowired('environment')\n], Beans.prototype, \"environment\", void 0);\n__decorate([\n Autowired('rowRenderer')\n], Beans.prototype, \"rowRenderer\", void 0);\n__decorate([\n Autowired('templateService')\n], Beans.prototype, \"templateService\", void 0);\n__decorate([\n Autowired('valueService')\n], Beans.prototype, \"valueService\", void 0);\n__decorate([\n Autowired('eventService')\n], Beans.prototype, \"eventService\", void 0);\n__decorate([\n Autowired('columnModel')\n], Beans.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('headerNavigationService')\n], Beans.prototype, \"headerNavigationService\", void 0);\n__decorate([\n Autowired('navigationService')\n], Beans.prototype, \"navigationService\", void 0);\n__decorate([\n Autowired('columnAnimationService')\n], Beans.prototype, \"columnAnimationService\", void 0);\n__decorate([\n Optional('rangeService')\n], Beans.prototype, \"rangeService\", void 0);\n__decorate([\n Autowired('focusService')\n], Beans.prototype, \"focusService\", void 0);\n__decorate([\n Optional('contextMenuFactory')\n], Beans.prototype, \"contextMenuFactory\", void 0);\n__decorate([\n Autowired('popupService')\n], Beans.prototype, \"popupService\", void 0);\n__decorate([\n Autowired('valueFormatterService')\n], Beans.prototype, \"valueFormatterService\", void 0);\n__decorate([\n Autowired('stylingService')\n], Beans.prototype, \"stylingService\", void 0);\n__decorate([\n Autowired('columnHoverService')\n], Beans.prototype, \"columnHoverService\", void 0);\n__decorate([\n Autowired('userComponentFactory')\n], Beans.prototype, \"userComponentFactory\", void 0);\n__decorate([\n Autowired('userComponentRegistry')\n], Beans.prototype, \"userComponentRegistry\", void 0);\n__decorate([\n Autowired('animationFrameService')\n], Beans.prototype, \"animationFrameService\", void 0);\n__decorate([\n Autowired('dragService')\n], Beans.prototype, \"dragService\", void 0);\n__decorate([\n Autowired('dragAndDropService')\n], Beans.prototype, \"dragAndDropService\", void 0);\n__decorate([\n Autowired('sortController')\n], Beans.prototype, \"sortController\", void 0);\n__decorate([\n Autowired('filterManager')\n], Beans.prototype, \"filterManager\", void 0);\n__decorate([\n Autowired('rowContainerHeightService')\n], Beans.prototype, \"rowContainerHeightService\", void 0);\n__decorate([\n Autowired('frameworkOverrides')\n], Beans.prototype, \"frameworkOverrides\", void 0);\n__decorate([\n Autowired('cellPositionUtils')\n], Beans.prototype, \"cellPositionUtils\", void 0);\n__decorate([\n Autowired('rowPositionUtils')\n], Beans.prototype, \"rowPositionUtils\", void 0);\n__decorate([\n Autowired('selectionService')\n], Beans.prototype, \"selectionService\", void 0);\n__decorate([\n Optional('selectionHandleFactory')\n], Beans.prototype, \"selectionHandleFactory\", void 0);\n__decorate([\n Autowired('rowCssClassCalculator')\n], Beans.prototype, \"rowCssClassCalculator\", void 0);\n__decorate([\n Autowired('rowModel')\n], Beans.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], Beans.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('ctrlsFactory')\n], Beans.prototype, \"ctrlsFactory\", void 0);\n__decorate([\n Autowired('agStackComponentsRegistry')\n], Beans.prototype, \"agStackComponentsRegistry\", void 0);\n__decorate([\n Autowired('valueCache')\n], Beans.prototype, \"valueCache\", void 0);\n__decorate([\n Autowired('rowNodeEventThrottle')\n], Beans.prototype, \"rowNodeEventThrottle\", void 0);\n__decorate([\n Autowired('localeService')\n], Beans.prototype, \"localeService\", void 0);\n__decorate([\n Autowired('valueParserService')\n], Beans.prototype, \"valueParserService\", void 0);\n__decorate([\n PostConstruct\n], Beans.prototype, \"postConstruct\", null);\nBeans = __decorate([\n Bean('beans')\n], Beans);\nexport { Beans };\n","import { Events } from \"../../events.mjs\";\nimport { isBrowserSafari, isIOSUserAgent } from \"../../utils/browser.mjs\";\nimport { isElementChildOfClass, isFocusableFormField } from \"../../utils/dom.mjs\";\nimport { isEventSupported, isStopPropagationForAgGrid } from \"../../utils/event.mjs\";\nimport { Beans } from \"../beans.mjs\";\nexport class CellMouseListenerFeature extends Beans {\n constructor(ctrl, beans, column) {\n super();\n this.cellCtrl = ctrl;\n this.beans = beans;\n this.column = column;\n }\n onMouseEvent(eventName, mouseEvent) {\n if (isStopPropagationForAgGrid(mouseEvent)) {\n return;\n }\n switch (eventName) {\n case 'click':\n this.onCellClicked(mouseEvent);\n break;\n case 'mousedown':\n case 'touchstart':\n this.onMouseDown(mouseEvent);\n break;\n case 'dblclick':\n this.onCellDoubleClicked(mouseEvent);\n break;\n case 'mouseout':\n this.onMouseOut(mouseEvent);\n break;\n case 'mouseover':\n this.onMouseOver(mouseEvent);\n break;\n }\n }\n onCellClicked(mouseEvent) {\n // iPad doesn't have double click - so we need to mimic it to enable editing for iPad.\n if (this.isDoubleClickOnIPad()) {\n this.onCellDoubleClicked(mouseEvent);\n mouseEvent.preventDefault(); // if we don't do this, then iPad zooms in\n return;\n }\n const { eventService, rangeService, gridOptionsService } = this.beans;\n const isMultiKey = mouseEvent.ctrlKey || mouseEvent.metaKey;\n if (rangeService && isMultiKey) {\n // the mousedown event has created the range already, so we only intersect if there is more than one\n // range on this cell\n if (rangeService.getCellRangeCount(this.cellCtrl.getCellPosition()) > 1) {\n rangeService.intersectLastRange(true);\n }\n }\n const cellClickedEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_CLICKED);\n eventService.dispatchEvent(cellClickedEvent);\n const colDef = this.column.getColDef();\n if (colDef.onCellClicked) {\n // to make callback async, do in a timeout\n window.setTimeout(() => colDef.onCellClicked(cellClickedEvent), 0);\n }\n const editOnSingleClick = (gridOptionsService.is('singleClickEdit') || colDef.singleClickEdit)\n && !gridOptionsService.is('suppressClickEdit');\n if (editOnSingleClick) {\n this.cellCtrl.startRowOrCellEdit();\n }\n }\n // returns true if on iPad and this is second 'click' event in 200ms\n isDoubleClickOnIPad() {\n if (!isIOSUserAgent() || isEventSupported('dblclick')) {\n return false;\n }\n const nowMillis = new Date().getTime();\n const res = nowMillis - this.lastIPadMouseClickEvent < 200;\n this.lastIPadMouseClickEvent = nowMillis;\n return res;\n }\n onCellDoubleClicked(mouseEvent) {\n const colDef = this.column.getColDef();\n // always dispatch event to eventService\n const cellDoubleClickedEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_DOUBLE_CLICKED);\n this.beans.eventService.dispatchEvent(cellDoubleClickedEvent);\n // check if colDef also wants to handle event\n if (typeof colDef.onCellDoubleClicked === 'function') {\n // to make the callback async, do in a timeout\n window.setTimeout(() => colDef.onCellDoubleClicked(cellDoubleClickedEvent), 0);\n }\n const editOnDoubleClick = !this.beans.gridOptionsService.is('singleClickEdit')\n && !this.beans.gridOptionsService.is('suppressClickEdit');\n if (editOnDoubleClick) {\n this.cellCtrl.startRowOrCellEdit(null, mouseEvent);\n }\n }\n onMouseDown(mouseEvent) {\n const { ctrlKey, metaKey, shiftKey } = mouseEvent;\n const target = mouseEvent.target;\n const { eventService, rangeService } = this.beans;\n // do not change the range for right-clicks inside an existing range\n if (this.isRightClickInExistingRange(mouseEvent)) {\n return;\n }\n const ranges = rangeService && rangeService.getCellRanges().length != 0;\n if (!shiftKey || !ranges) {\n // We only need to pass true to focusCell when the browser is Safari and we are trying\n // to focus the cell itself. This should never be true if the mousedown was triggered\n // due to a click on a cell editor for example.\n const forceBrowserFocus = (isBrowserSafari()) && !this.cellCtrl.isEditing() && !isFocusableFormField(target);\n this.cellCtrl.focusCell(forceBrowserFocus);\n }\n // if shift clicking, and a range exists, we keep the focus on the cell that started the\n // range as the user then changes the range selection.\n if (shiftKey && ranges) {\n // this stops the cell from getting focused\n mouseEvent.preventDefault();\n }\n // if we are clicking on a checkbox, we need to make sure the cell wrapping that checkbox\n // is focused but we don't want to change the range selection, so return here.\n if (this.containsWidget(target)) {\n return;\n }\n if (rangeService) {\n const thisCell = this.cellCtrl.getCellPosition();\n if (shiftKey) {\n rangeService.extendLatestRangeToCell(thisCell);\n }\n else {\n const isMultiKey = ctrlKey || metaKey;\n rangeService.setRangeToCell(thisCell, isMultiKey);\n }\n }\n eventService.dispatchEvent(this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_DOWN));\n }\n isRightClickInExistingRange(mouseEvent) {\n const { rangeService } = this.beans;\n if (rangeService) {\n const cellInRange = rangeService.isCellInAnyRange(this.cellCtrl.getCellPosition());\n if (cellInRange && mouseEvent.button === 2) {\n return true;\n }\n }\n return false;\n }\n containsWidget(target) {\n return isElementChildOfClass(target, 'ag-selection-checkbox', 3);\n }\n onMouseOut(mouseEvent) {\n if (this.mouseStayingInsideCell(mouseEvent)) {\n return;\n }\n const cellMouseOutEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_OUT);\n this.beans.eventService.dispatchEvent(cellMouseOutEvent);\n this.beans.columnHoverService.clearMouseOver();\n }\n onMouseOver(mouseEvent) {\n if (this.mouseStayingInsideCell(mouseEvent)) {\n return;\n }\n const cellMouseOverEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_OVER);\n this.beans.eventService.dispatchEvent(cellMouseOverEvent);\n this.beans.columnHoverService.setMouseOver([this.column]);\n }\n mouseStayingInsideCell(e) {\n if (!e.target || !e.relatedTarget) {\n return false;\n }\n const eGui = this.cellCtrl.getGui();\n const cellContainsTarget = eGui.contains(e.target);\n const cellContainsRelatedTarget = eGui.contains(e.relatedTarget);\n return cellContainsTarget && cellContainsRelatedTarget;\n }\n destroy() {\n }\n}\n","import { BeanStub } from \"../../context/beanStub.mjs\";\nimport { KeyCode } from \"../../constants/keyCode.mjs\";\nimport { isDeleteKey } from \"../../utils/keyboard.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nexport class CellKeyboardListenerFeature extends BeanStub {\n constructor(ctrl, beans, column, rowNode, rowCtrl) {\n super();\n this.cellCtrl = ctrl;\n this.beans = beans;\n this.rowNode = rowNode;\n this.rowCtrl = rowCtrl;\n }\n setComp(eGui) {\n this.eGui = eGui;\n }\n onKeyDown(event) {\n const key = event.key;\n switch (key) {\n case KeyCode.ENTER:\n this.onEnterKeyDown(event);\n break;\n case KeyCode.F2:\n this.onF2KeyDown(event);\n break;\n case KeyCode.ESCAPE:\n this.onEscapeKeyDown(event);\n break;\n case KeyCode.TAB:\n this.onTabKeyDown(event);\n break;\n case KeyCode.BACKSPACE:\n case KeyCode.DELETE:\n this.onBackspaceOrDeleteKeyDown(key, event);\n break;\n case KeyCode.DOWN:\n case KeyCode.UP:\n case KeyCode.RIGHT:\n case KeyCode.LEFT:\n this.onNavigationKeyDown(event, key);\n break;\n }\n }\n onNavigationKeyDown(event, key) {\n if (this.cellCtrl.isEditing()) {\n return;\n }\n if (event.shiftKey && this.cellCtrl.isRangeSelectionEnabled()) {\n this.onShiftRangeSelect(event);\n }\n else {\n this.beans.navigationService.navigateToNextCell(event, key, this.cellCtrl.getCellPosition(), true);\n }\n // if we don't prevent default, the grid will scroll with the navigation keys\n event.preventDefault();\n }\n onShiftRangeSelect(event) {\n if (!this.beans.rangeService) {\n return;\n }\n const endCell = this.beans.rangeService.extendLatestRangeInDirection(event);\n if (endCell) {\n this.beans.navigationService.ensureCellVisible(endCell);\n }\n }\n onTabKeyDown(event) {\n this.beans.navigationService.onTabKeyDown(this.cellCtrl, event);\n }\n onBackspaceOrDeleteKeyDown(key, event) {\n const { cellCtrl, beans, rowNode } = this;\n const { gridOptionsService, rangeService, eventService } = beans;\n if (cellCtrl.isEditing()) {\n return;\n }\n eventService.dispatchEvent({ type: Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_START });\n if (isDeleteKey(key, gridOptionsService.is('enableCellEditingOnBackspace'))) {\n if (rangeService && gridOptionsService.isEnableRangeSelection()) {\n rangeService.clearCellRangeCellValues({ dispatchWrapperEvents: true, wrapperEventSource: 'deleteKey' });\n }\n else if (cellCtrl.isCellEditable()) {\n rowNode.setDataValue(cellCtrl.getColumn(), null, 'cellClear');\n }\n }\n else {\n cellCtrl.startRowOrCellEdit(key, event);\n }\n eventService.dispatchEvent({ type: Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_END });\n }\n onEnterKeyDown(e) {\n if (this.cellCtrl.isEditing() || this.rowCtrl.isEditing()) {\n this.cellCtrl.stopEditingAndFocus(false, e.shiftKey);\n }\n else {\n if (this.beans.gridOptionsService.is('enterNavigatesVertically')) {\n const key = e.shiftKey ? KeyCode.UP : KeyCode.DOWN;\n this.beans.navigationService.navigateToNextCell(null, key, this.cellCtrl.getCellPosition(), false);\n }\n else {\n this.cellCtrl.startRowOrCellEdit(KeyCode.ENTER, e);\n if (this.cellCtrl.isEditing()) {\n // if we started editing, then we need to prevent default, otherwise the Enter action can get\n // applied to the cell editor. this happened, for example, with largeTextCellEditor where not\n // preventing default results in a 'new line' character getting inserted in the text area\n // when the editing was started\n e.preventDefault();\n }\n }\n }\n }\n onF2KeyDown(event) {\n if (!this.cellCtrl.isEditing()) {\n this.cellCtrl.startRowOrCellEdit(KeyCode.F2, event);\n }\n }\n onEscapeKeyDown(event) {\n if (this.cellCtrl.isEditing()) {\n this.cellCtrl.stopRowOrCellEdit(true);\n this.cellCtrl.focusCell(true);\n }\n }\n processCharacter(event) {\n // check this, in case focus is on a (for example) a text field inside the cell,\n // in which cse we should not be listening for these key pressed\n const eventTarget = event.target;\n const eventOnChildComponent = eventTarget !== this.eGui;\n if (eventOnChildComponent || this.cellCtrl.isEditing()) {\n return;\n }\n const key = event.key;\n if (key === ' ') {\n this.onSpaceKeyDown(event);\n }\n else {\n this.cellCtrl.startRowOrCellEdit(key, event);\n // if we don't prevent default, then the event also gets applied to the text field\n // (at least when doing the default editor), but we need to allow the editor to decide\n // what it wants to do. we only do this IF editing was started - otherwise it messes\n // up when the use is not doing editing, but using rendering with text fields in cellRenderer\n // (as it would block the the user from typing into text fields).\n event.preventDefault();\n }\n }\n onSpaceKeyDown(event) {\n const { gridOptionsService } = this.beans;\n if (!this.cellCtrl.isEditing() && gridOptionsService.isRowSelection()) {\n const currentSelection = this.rowNode.isSelected();\n const newSelection = !currentSelection;\n if (newSelection || !gridOptionsService.is('suppressRowDeselection')) {\n const groupSelectsFiltered = this.beans.gridOptionsService.is('groupSelectsFiltered');\n const updatedCount = this.rowNode.setSelectedParams({\n newValue: newSelection,\n rangeSelect: event.shiftKey,\n groupSelectsFiltered: groupSelectsFiltered,\n event,\n source: 'spaceKey',\n });\n if (currentSelection === undefined && updatedCount === 0) {\n this.rowNode.setSelectedParams({\n newValue: false,\n rangeSelect: event.shiftKey,\n groupSelectsFiltered: groupSelectsFiltered,\n event,\n source: 'spaceKey',\n });\n }\n }\n }\n // prevent default as space key, by default, moves browser scroll down\n event.preventDefault();\n }\n destroy() {\n super.destroy();\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from \"../widgets/component.mjs\";\nimport { PostConstruct } from \"../context/context.mjs\";\nimport { createIconNoSpan } from \"../utils/icon.mjs\";\nexport class DndSourceComp extends Component {\n constructor(rowNode, column, eCell) {\n super(/* html */ `
`);\n this.rowNode = rowNode;\n this.column = column;\n this.eCell = eCell;\n }\n postConstruct() {\n const eGui = this.getGui();\n eGui.appendChild(createIconNoSpan('rowDrag', this.gridOptionsService, null));\n // we need to stop the event propagation here to avoid starting a range selection while dragging\n this.addGuiEventListener('mousedown', (e) => {\n e.stopPropagation();\n });\n this.addDragSource();\n this.checkVisibility();\n }\n addDragSource() {\n this.addGuiEventListener('dragstart', this.onDragStart.bind(this));\n }\n onDragStart(dragEvent) {\n const providedOnRowDrag = this.column.getColDef().dndSourceOnRowDrag;\n dragEvent.dataTransfer.setDragImage(this.eCell, 0, 0);\n // default behaviour is to convert data to json and set into drag component\n const defaultOnRowDrag = () => {\n try {\n const jsonData = JSON.stringify(this.rowNode.data);\n dragEvent.dataTransfer.setData('application/json', jsonData);\n dragEvent.dataTransfer.setData('text/plain', jsonData);\n }\n catch (e) {\n // if we cannot convert the data to json, then we do not set the type\n }\n };\n if (providedOnRowDrag) {\n const params = {\n rowNode: this.rowNode, dragEvent: dragEvent,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context\n };\n providedOnRowDrag(params);\n }\n else {\n defaultOnRowDrag();\n }\n }\n checkVisibility() {\n const visible = this.column.isDndSource(this.rowNode);\n this.setDisplayed(visible);\n }\n}\n__decorate([\n PostConstruct\n], DndSourceComp.prototype, \"postConstruct\", null);\n","import { Events } from \"../../events.mjs\";\nimport { CellRangeFeature } from \"./cellRangeFeature.mjs\";\nimport { exists, makeNull } from \"../../utils/generic.mjs\";\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { CellPositionFeature } from \"./cellPositionFeature.mjs\";\nimport { escapeString } from \"../../utils/string.mjs\";\nimport { CellCustomStyleFeature } from \"./cellCustomStyleFeature.mjs\";\nimport { TooltipFeature } from \"../../widgets/tooltipFeature.mjs\";\nimport { CellMouseListenerFeature } from \"./cellMouseListenerFeature.mjs\";\nimport { CellKeyboardListenerFeature } from \"./cellKeyboardListenerFeature.mjs\";\nimport { KeyCode } from \"../../constants/keyCode.mjs\";\nimport { CheckboxSelectionComponent } from \"../checkboxSelectionComponent.mjs\";\nimport { DndSourceComp } from \"../dndSourceComp.mjs\";\nimport { doOnce } from \"../../utils/function.mjs\";\nimport { RowDragComp } from \"../row/rowDragComp.mjs\";\nimport { getValueUsingField } from \"../../utils/object.mjs\";\nimport { getElementSize } from \"../../utils/dom.mjs\";\nimport { setAriaColIndex } from \"../../utils/aria.mjs\";\nconst CSS_CELL = 'ag-cell';\nconst CSS_AUTO_HEIGHT = 'ag-cell-auto-height';\nconst CSS_NORMAL_HEIGHT = 'ag-cell-normal-height';\nconst CSS_CELL_FOCUS = 'ag-cell-focus';\nconst CSS_CELL_FIRST_RIGHT_PINNED = 'ag-cell-first-right-pinned';\nconst CSS_CELL_LAST_LEFT_PINNED = 'ag-cell-last-left-pinned';\nconst CSS_CELL_NOT_INLINE_EDITING = 'ag-cell-not-inline-editing';\nconst CSS_COLUMN_HOVER = 'ag-column-hover';\nconst CSS_CELL_WRAP_TEXT = 'ag-cell-wrap-text';\nlet instanceIdSequence = 0;\nexport class CellCtrl extends BeanStub {\n constructor(column, rowNode, beans, rowCtrl) {\n super();\n this.cellRangeFeature = null;\n this.cellPositionFeature = null;\n this.cellCustomStyleFeature = null;\n this.tooltipFeature = null;\n this.cellMouseListenerFeature = null;\n this.cellKeyboardListenerFeature = null;\n this.suppressRefreshCell = false;\n this.onCellCompAttachedFuncs = [];\n this.column = column;\n this.rowNode = rowNode;\n this.beans = beans;\n this.rowCtrl = rowCtrl;\n // unique id to this instance, including the column ID to help with debugging in React as it's used in 'key'\n this.instanceId = column.getId() + '-' + instanceIdSequence++;\n const colDef = this.column.getColDef();\n this.colIdSanitised = escapeString(this.column.getId());\n if (!this.beans.gridOptionsService.is('suppressCellFocus')) {\n this.tabIndex = -1;\n }\n this.isCellRenderer = colDef.cellRenderer != null || colDef.cellRendererSelector != null;\n this.createCellPosition();\n this.addFeatures();\n this.updateAndFormatValue(true);\n }\n shouldRestoreFocus() {\n return this.beans.focusService.shouldRestoreFocus(this.cellPosition);\n }\n addFeatures() {\n this.cellPositionFeature = new CellPositionFeature(this, this.beans);\n this.addDestroyFunc(() => { var _a; (_a = this.cellPositionFeature) === null || _a === void 0 ? void 0 : _a.destroy(); this.cellPositionFeature = null; });\n this.cellCustomStyleFeature = new CellCustomStyleFeature(this, this.beans);\n this.addDestroyFunc(() => { var _a; (_a = this.cellCustomStyleFeature) === null || _a === void 0 ? void 0 : _a.destroy(); this.cellCustomStyleFeature = null; });\n this.cellMouseListenerFeature = new CellMouseListenerFeature(this, this.beans, this.column);\n this.addDestroyFunc(() => { var _a; (_a = this.cellMouseListenerFeature) === null || _a === void 0 ? void 0 : _a.destroy(); this.cellMouseListenerFeature = null; });\n this.cellKeyboardListenerFeature = new CellKeyboardListenerFeature(this, this.beans, this.column, this.rowNode, this.rowCtrl);\n this.addDestroyFunc(() => { var _a; (_a = this.cellKeyboardListenerFeature) === null || _a === void 0 ? void 0 : _a.destroy(); this.cellKeyboardListenerFeature = null; });\n const rangeSelectionEnabled = this.beans.rangeService && this.beans.gridOptionsService.isEnableRangeSelection();\n if (rangeSelectionEnabled) {\n this.cellRangeFeature = new CellRangeFeature(this.beans, this);\n this.addDestroyFunc(() => { var _a; (_a = this.cellRangeFeature) === null || _a === void 0 ? void 0 : _a.destroy(); this.cellRangeFeature = null; });\n }\n if (this.column.isTooltipEnabled()) {\n this.addTooltipFeature();\n }\n }\n addTooltipFeature() {\n const getTooltipValue = () => {\n const colDef = this.column.getColDef();\n const data = this.rowNode.data;\n if (colDef.tooltipField && exists(data)) {\n return getValueUsingField(data, colDef.tooltipField, this.column.isTooltipFieldContainsDots());\n }\n const valueGetter = colDef.tooltipValueGetter;\n if (valueGetter) {\n return valueGetter({\n location: 'cell',\n api: this.beans.gridOptionsService.api,\n columnApi: this.beans.gridOptionsService.columnApi,\n context: this.beans.gridOptionsService.context,\n colDef: this.column.getColDef(),\n column: this.column,\n rowIndex: this.cellPosition.rowIndex,\n node: this.rowNode,\n data: this.rowNode.data,\n value: this.value,\n valueFormatted: this.valueFormatted,\n });\n }\n return null;\n };\n const tooltipCtrl = {\n getColumn: () => this.column,\n getColDef: () => this.column.getColDef(),\n getRowIndex: () => this.cellPosition.rowIndex,\n getRowNode: () => this.rowNode,\n getGui: () => this.getGui(),\n getLocation: () => 'cell',\n getTooltipValue: getTooltipValue,\n // this makes no sense, why is the cell formatted value passed to the tooltip???\n getValueFormatted: () => this.valueFormatted\n };\n this.tooltipFeature = new TooltipFeature(tooltipCtrl, this.beans);\n this.addDestroyFunc(() => { var _a; (_a = this.tooltipFeature) === null || _a === void 0 ? void 0 : _a.destroy(); this.tooltipFeature = null; });\n }\n setComp(comp, eGui, eCellWrapper, printLayout, startEditing) {\n var _a, _b, _c, _d;\n this.cellComp = comp;\n this.eGui = eGui;\n this.printLayout = printLayout;\n this.addDomData();\n this.onCellFocused(this.focusEventToRestore);\n this.applyStaticCssClasses();\n this.setWrapText();\n this.onFirstRightPinnedChanged();\n this.onLastLeftPinnedChanged();\n this.onColumnHover();\n this.setupControlComps();\n if (eCellWrapper) {\n this.setupAutoHeight(eCellWrapper);\n }\n this.setAriaColIndex();\n (_a = this.cellPositionFeature) === null || _a === void 0 ? void 0 : _a.setComp(eGui);\n (_b = this.cellCustomStyleFeature) === null || _b === void 0 ? void 0 : _b.setComp(comp);\n (_c = this.tooltipFeature) === null || _c === void 0 ? void 0 : _c.setComp(eGui);\n (_d = this.cellKeyboardListenerFeature) === null || _d === void 0 ? void 0 : _d.setComp(this.eGui);\n if (this.cellRangeFeature) {\n this.cellRangeFeature.setComp(comp, eGui);\n }\n if (startEditing && this.isCellEditable()) {\n this.startEditing();\n }\n else {\n this.showValue();\n }\n if (this.onCellCompAttachedFuncs.length) {\n this.onCellCompAttachedFuncs.forEach(func => func());\n this.onCellCompAttachedFuncs = [];\n }\n }\n setupAutoHeight(eCellWrapper) {\n if (!this.column.isAutoHeight()) {\n return;\n }\n const eParentCell = eCellWrapper.parentElement;\n // taking minRowHeight from getRowHeightForNode means the getRowHeight() callback is used,\n // thus allowing different min heights for different rows.\n const minRowHeight = this.beans.gridOptionsService.getRowHeightForNode(this.rowNode).height;\n const measureHeight = (timesCalled) => {\n if (this.editing) {\n return;\n }\n // because of the retry's below, it's possible the retry's go beyond\n // the rows life.\n if (!this.isAlive()) {\n return;\n }\n const { paddingTop, paddingBottom, borderBottomWidth, borderTopWidth } = getElementSize(eParentCell);\n const extraHeight = paddingTop + paddingBottom + borderBottomWidth + borderTopWidth;\n const wrapperHeight = eCellWrapper.offsetHeight;\n const autoHeight = wrapperHeight + extraHeight;\n if (timesCalled < 5) {\n // if not in doc yet, means framework not yet inserted, so wait for next VM turn,\n // maybe it will be ready next VM turn\n const doc = this.beans.gridOptionsService.getDocument();\n const notYetInDom = !doc || !doc.contains(eCellWrapper);\n // this happens in React, where React hasn't put any content in. we say 'possibly'\n // as a) may not be React and b) the cell could be empty anyway\n const possiblyNoContentYet = autoHeight == 0;\n if (notYetInDom || possiblyNoContentYet) {\n this.beans.frameworkOverrides.setTimeout(() => measureHeight(timesCalled + 1), 0);\n return;\n }\n }\n const newHeight = Math.max(autoHeight, minRowHeight);\n this.rowNode.setRowAutoHeight(newHeight, this.column);\n };\n const listener = () => measureHeight(0);\n // do once to set size in case size doesn't change, common when cell is blank\n listener();\n const destroyResizeObserver = this.beans.resizeObserverService.observeResize(eCellWrapper, listener);\n this.addDestroyFunc(() => {\n destroyResizeObserver();\n this.rowNode.setRowAutoHeight(undefined, this.column);\n });\n }\n getInstanceId() {\n return this.instanceId;\n }\n getIncludeSelection() {\n return this.includeSelection;\n }\n getIncludeRowDrag() {\n return this.includeRowDrag;\n }\n getIncludeDndSource() {\n return this.includeDndSource;\n }\n getColumnIdSanitised() {\n return this.colIdSanitised;\n }\n getTabIndex() {\n return this.tabIndex;\n }\n getIsCellRenderer() {\n return this.isCellRenderer;\n }\n getValueToDisplay() {\n return this.valueFormatted != null ? this.valueFormatted : this.value;\n }\n showValue(forceNewCellRendererInstance = false) {\n const valueToDisplay = this.getValueToDisplay();\n let compDetails;\n if (this.isCellRenderer) {\n const params = this.createCellRendererParams();\n compDetails = this.beans.userComponentFactory.getCellRendererDetails(this.column.getColDef(), params);\n }\n this.cellComp.setRenderDetails(compDetails, valueToDisplay, forceNewCellRendererInstance);\n this.refreshHandle();\n }\n setupControlComps() {\n const colDef = this.column.getColDef();\n this.includeSelection = this.isIncludeControl(colDef.checkboxSelection);\n this.includeRowDrag = this.isIncludeControl(colDef.rowDrag);\n this.includeDndSource = this.isIncludeControl(colDef.dndSource);\n this.cellComp.setIncludeSelection(this.includeSelection);\n this.cellComp.setIncludeDndSource(this.includeDndSource);\n this.cellComp.setIncludeRowDrag(this.includeRowDrag);\n }\n isForceWrapper() {\n // text selection requires the value to be wrapped in another element\n const forceWrapper = this.beans.gridOptionsService.is('enableCellTextSelection') || this.column.isAutoHeight();\n return forceWrapper;\n }\n isIncludeControl(value) {\n const rowNodePinned = this.rowNode.rowPinned != null;\n const isFunc = typeof value === 'function';\n const res = rowNodePinned ? false : isFunc || value === true;\n return res;\n }\n refreshShouldDestroy() {\n const colDef = this.column.getColDef();\n const selectionChanged = this.includeSelection != this.isIncludeControl(colDef.checkboxSelection);\n const rowDragChanged = this.includeRowDrag != this.isIncludeControl(colDef.rowDrag);\n const dndSourceChanged = this.includeDndSource != this.isIncludeControl(colDef.dndSource);\n return selectionChanged || rowDragChanged || dndSourceChanged;\n }\n // either called internally if single cell editing, or called by rowRenderer if row editing\n startEditing(key = null, cellStartedEdit = false, event = null) {\n if (!this.isCellEditable() || this.editing) {\n return;\n }\n // because of async in React, the cellComp may not be set yet, if no cellComp then we are\n // yet to initialise the cell, so we re-schedule this operation for when celLComp is attached\n if (!this.cellComp) {\n this.onCellCompAttachedFuncs.push(() => { this.startEditing(key, cellStartedEdit, event); });\n return;\n }\n const editorParams = this.createCellEditorParams(key, cellStartedEdit);\n const colDef = this.column.getColDef();\n const compDetails = this.beans.userComponentFactory.getCellEditorDetails(colDef, editorParams);\n // if cellEditorSelector was used, we give preference to popup and popupPosition from the selector\n const popup = (compDetails === null || compDetails === void 0 ? void 0 : compDetails.popupFromSelector) != null ? compDetails.popupFromSelector : !!colDef.cellEditorPopup;\n const position = (compDetails === null || compDetails === void 0 ? void 0 : compDetails.popupPositionFromSelector) != null ? compDetails.popupPositionFromSelector : colDef.cellEditorPopupPosition;\n this.setEditing(true);\n this.cellComp.setEditDetails(compDetails, popup, position);\n const e = this.createEvent(event, Events.EVENT_CELL_EDITING_STARTED);\n this.beans.eventService.dispatchEvent(e);\n }\n setEditing(editing) {\n if (this.editing === editing) {\n return;\n }\n this.editing = editing;\n this.refreshHandle();\n }\n // pass in 'true' to cancel the editing.\n stopRowOrCellEdit(cancel = false) {\n if (this.beans.gridOptionsService.get('editType') === 'fullRow') {\n this.rowCtrl.stopRowEditing(cancel);\n }\n else {\n this.stopEditing(cancel);\n }\n }\n onPopupEditorClosed() {\n if (!this.isEditing()) {\n return;\n }\n // note: this happens because of a click outside of the grid or if the popupEditor\n // is closed with `Escape` key. if another cell was clicked, then the editing will\n // have already stopped and returned on the conditional above.\n this.stopEditingAndFocus();\n }\n takeValueFromCellEditor(cancel) {\n const noValueResult = { newValueExists: false };\n if (cancel) {\n return noValueResult;\n }\n const cellEditor = this.cellComp.getCellEditor();\n if (!cellEditor) {\n return noValueResult;\n }\n const userWantsToCancel = cellEditor.isCancelAfterEnd && cellEditor.isCancelAfterEnd();\n if (userWantsToCancel) {\n return noValueResult;\n }\n const newValue = cellEditor.getValue();\n return {\n newValue: newValue,\n newValueExists: true\n };\n }\n /**\n * @returns `True` if the value changes, otherwise `False`.\n */\n saveNewValue(oldValue, newValue) {\n if (newValue === oldValue) {\n return false;\n }\n // we suppressRefreshCell because the call to rowNode.setDataValue() results in change detection\n // getting triggered, which results in all cells getting refreshed. we do not want this refresh\n // to happen on this call as we want to call it explicitly below. otherwise refresh gets called twice.\n // if we only did this refresh (and not the one below) then the cell would flash and not be forced.\n this.suppressRefreshCell = true;\n const valueChanged = this.rowNode.setDataValue(this.column, newValue, 'edit');\n this.suppressRefreshCell = false;\n return valueChanged;\n }\n /**\n * Ends the Cell Editing\n * @param cancel `True` if the edit process is being canceled.\n * @returns `True` if the value of the `GridCell` has been updated, otherwise `False`.\n */\n stopEditing(cancel = false) {\n if (!this.editing) {\n return false;\n }\n const { newValue, newValueExists } = this.takeValueFromCellEditor(cancel);\n const oldValue = this.rowNode.getValueFromValueService(this.column);\n let valueChanged = false;\n if (newValueExists) {\n valueChanged = this.saveNewValue(oldValue, newValue);\n }\n this.setEditing(false);\n this.cellComp.setEditDetails(); // passing nothing stops editing\n this.updateAndFormatValue();\n this.refreshCell({ forceRefresh: true, suppressFlash: true });\n this.dispatchEditingStoppedEvent(oldValue, newValue, !cancel && !!valueChanged);\n return valueChanged;\n }\n dispatchEditingStoppedEvent(oldValue, newValue, valueChanged) {\n const editingStoppedEvent = Object.assign(Object.assign({}, this.createEvent(null, Events.EVENT_CELL_EDITING_STOPPED)), { oldValue,\n newValue,\n valueChanged });\n this.beans.eventService.dispatchEvent(editingStoppedEvent);\n }\n createCellEditorParams(key, cellStartedEdit) {\n return {\n value: this.rowNode.getValueFromValueService(this.column),\n eventKey: key,\n column: this.column,\n colDef: this.column.getColDef(),\n rowIndex: this.getCellPosition().rowIndex,\n node: this.rowNode,\n data: this.rowNode.data,\n api: this.beans.gridOptionsService.api,\n cellStartedEdit: cellStartedEdit,\n columnApi: this.beans.gridOptionsService.columnApi,\n context: this.beans.gridOptionsService.context,\n onKeyDown: this.onKeyDown.bind(this),\n stopEditing: this.stopEditingAndFocus.bind(this),\n eGridCell: this.getGui(),\n parseValue: this.parseValue.bind(this),\n formatValue: this.formatValue.bind(this)\n };\n }\n createCellRendererParams() {\n const res = {\n value: this.value,\n valueFormatted: this.valueFormatted,\n getValue: () => this.rowNode.getValueFromValueService(this.column),\n setValue: (value) => this.beans.valueService.setValue(this.rowNode, this.column, value),\n formatValue: this.formatValue.bind(this),\n data: this.rowNode.data,\n node: this.rowNode,\n pinned: this.column.getPinned(),\n colDef: this.column.getColDef(),\n column: this.column,\n rowIndex: this.getCellPosition().rowIndex,\n api: this.beans.gridOptionsService.api,\n columnApi: this.beans.gridOptionsService.columnApi,\n context: this.beans.gridOptionsService.context,\n refreshCell: this.refreshCell.bind(this),\n eGridCell: this.getGui(),\n eParentOfValue: this.cellComp.getParentOfValue(),\n registerRowDragger: (rowDraggerElement, dragStartPixels, value, suppressVisibilityChange) => this.registerRowDragger(rowDraggerElement, dragStartPixels, suppressVisibilityChange),\n };\n return res;\n }\n parseValue(newValue) {\n return this.beans.valueParserService.parseValue(this.column, this.rowNode, newValue, this.getValue());\n }\n setFocusOutOnEditor() {\n if (!this.editing) {\n return;\n }\n const cellEditor = this.cellComp.getCellEditor();\n if (cellEditor && cellEditor.focusOut) {\n cellEditor.focusOut();\n }\n }\n setFocusInOnEditor() {\n if (!this.editing) {\n return;\n }\n const cellEditor = this.cellComp.getCellEditor();\n if (cellEditor && cellEditor.focusIn) {\n // if the editor is present, then we just focus it\n cellEditor.focusIn();\n }\n else {\n // if the editor is not present, it means async cell editor (eg React fibre)\n // and we are trying to set focus before the cell editor is present, so we\n // focus the cell instead\n this.focusCell(true);\n }\n }\n onCellChanged(event) {\n // because of async in React, the cellComp may not be set yet, if no cellComp then we are\n // yet to initialise the cell, so no need to refresh.\n if (!this.cellComp) {\n return;\n }\n const eventImpactsThisCell = event.column === this.column;\n if (eventImpactsThisCell) {\n this.refreshCell({});\n }\n }\n // + stop editing {forceRefresh: true, suppressFlash: true}\n // + event cellChanged {}\n // + cellRenderer.params.refresh() {} -> method passes 'as is' to the cellRenderer, so params could be anything\n // + rowCtrl: event dataChanged {suppressFlash: !update, newData: !update}\n // + rowCtrl: api refreshCells() {animate: true/false}\n // + rowRenderer: api softRefreshView() {}\n refreshCell(params) {\n var _a, _b, _c;\n // if we are in the middle of 'stopEditing', then we don't refresh here, as refresh gets called explicitly\n if (this.suppressRefreshCell || this.editing) {\n return;\n }\n // In React, due to async, it's possible a refresh was asked for before the CellComp\n // has been set. If this happens, we skip the refresh, as the cell is going to be\n // initialised anyway once the CellComp is set.\n if (!this.cellComp) {\n return;\n }\n const colDef = this.column.getColDef();\n const newData = params != null && !!params.newData;\n const suppressFlash = (params != null && !!params.suppressFlash) || !!colDef.suppressCellFlash;\n // we always refresh if cell has no value - this can happen when user provides Cell Renderer and the\n // cell renderer doesn't rely on a value, instead it could be looking directly at the data, or maybe\n // printing the current time (which would be silly)???. Generally speaking\n // non of {field, valueGetter, showRowGroup} is bad in the users application, however for this edge case, it's\n // best always refresh and take the performance hit rather than never refresh and users complaining in support\n // that cells are not updating.\n const noValueProvided = colDef.field == null && colDef.valueGetter == null && colDef.showRowGroup == null;\n const forceRefresh = (params && params.forceRefresh) || noValueProvided || newData;\n const valuesDifferent = this.updateAndFormatValue();\n const dataNeedsUpdating = forceRefresh || valuesDifferent;\n if (dataNeedsUpdating) {\n // if it's 'new data', then we don't refresh the cellRenderer, even if refresh method is available.\n // this is because if the whole data is new (ie we are showing stock price 'BBA' now and not 'SSD')\n // then we are not showing a movement in the stock price, rather we are showing different stock.\n this.showValue(newData);\n // we don't want to flash the cells when processing a filter change, as otherwise the UI would\n // be to busy. see comment in FilterManager with regards processingFilterChange\n const processingFilterChange = this.beans.filterManager.isSuppressFlashingCellsBecauseFiltering();\n const flashCell = !suppressFlash && !processingFilterChange &&\n (this.beans.gridOptionsService.is('enableCellChangeFlash') || colDef.enableCellChangeFlash);\n if (flashCell) {\n this.flashCell();\n }\n (_a = this.cellCustomStyleFeature) === null || _a === void 0 ? void 0 : _a.applyUserStyles();\n (_b = this.cellCustomStyleFeature) === null || _b === void 0 ? void 0 : _b.applyClassesFromColDef();\n }\n this.refreshToolTip();\n // we do cellClassRules even if the value has not changed, so that users who have rules that\n // look at other parts of the row (where the other part of the row might of changed) will work.\n (_c = this.cellCustomStyleFeature) === null || _c === void 0 ? void 0 : _c.applyCellClassRules();\n }\n // cell editors call this, when they want to stop for reasons other\n // than what we pick up on. eg selecting from a dropdown ends editing.\n stopEditingAndFocus(suppressNavigateAfterEdit = false, shiftKey = false) {\n this.stopRowOrCellEdit();\n this.focusCell(true);\n if (!suppressNavigateAfterEdit) {\n this.navigateAfterEdit(shiftKey);\n }\n }\n navigateAfterEdit(shiftKey) {\n const enterNavigatesVerticallyAfterEdit = this.beans.gridOptionsService.is('enterNavigatesVerticallyAfterEdit');\n if (enterNavigatesVerticallyAfterEdit) {\n const key = shiftKey ? KeyCode.UP : KeyCode.DOWN;\n this.beans.navigationService.navigateToNextCell(null, key, this.getCellPosition(), false);\n }\n }\n // user can also call this via API\n flashCell(delays) {\n const flashDelay = delays && delays.flashDelay;\n const fadeDelay = delays && delays.fadeDelay;\n this.animateCell('data-changed', flashDelay, fadeDelay);\n }\n animateCell(cssName, flashDelay, fadeDelay) {\n var _a, _b;\n if (!this.cellComp) {\n return;\n }\n const fullName = `ag-cell-${cssName}`;\n const animationFullName = `ag-cell-${cssName}-animation`;\n const { gridOptionsService } = this.beans;\n if (!flashDelay) {\n flashDelay = (_a = gridOptionsService.getNum('cellFlashDelay')) !== null && _a !== void 0 ? _a : 500;\n }\n if (!exists(fadeDelay)) {\n fadeDelay = (_b = gridOptionsService.getNum('cellFadeDelay')) !== null && _b !== void 0 ? _b : 1000;\n }\n // we want to highlight the cells, without any animation\n this.cellComp.addOrRemoveCssClass(fullName, true);\n this.cellComp.addOrRemoveCssClass(animationFullName, false);\n // then once that is applied, we remove the highlight with animation\n window.setTimeout(() => {\n if (!this.isAlive()) {\n return;\n }\n this.cellComp.addOrRemoveCssClass(fullName, false);\n this.cellComp.addOrRemoveCssClass(animationFullName, true);\n this.eGui.style.transition = `background-color ${fadeDelay}ms`;\n window.setTimeout(() => {\n if (!this.isAlive()) {\n return;\n }\n // and then to leave things as we got them, we remove the animation\n this.cellComp.addOrRemoveCssClass(animationFullName, false);\n this.eGui.style.transition = '';\n }, fadeDelay);\n }, flashDelay);\n }\n onFlashCells(event) {\n if (!this.cellComp) {\n return;\n }\n const cellId = this.beans.cellPositionUtils.createId(this.getCellPosition());\n const shouldFlash = event.cells[cellId];\n if (shouldFlash) {\n this.animateCell('highlight');\n }\n }\n isCellEditable() {\n return this.column.isCellEditable(this.rowNode);\n }\n isSuppressFillHandle() {\n return this.column.isSuppressFillHandle();\n }\n formatValue(value) {\n var _a;\n return (_a = this.callValueFormatter(value)) !== null && _a !== void 0 ? _a : value;\n }\n callValueFormatter(value) {\n return this.beans.valueFormatterService.formatValue(this.column, this.rowNode, value);\n }\n updateAndFormatValue(force = false) {\n const oldValue = this.value;\n const oldValueFormatted = this.valueFormatted;\n this.value = this.rowNode.getValueFromValueService(this.column);\n this.valueFormatted = this.callValueFormatter(this.value);\n const valuesDifferent = force ? true :\n !this.valuesAreEqual(oldValue, this.value) || this.valueFormatted != oldValueFormatted;\n return valuesDifferent;\n }\n valuesAreEqual(val1, val2) {\n // if the user provided an equals method, use that, otherwise do simple comparison\n const colDef = this.column.getColDef();\n return colDef.equals ? colDef.equals(val1, val2) : val1 === val2;\n }\n getComp() {\n return this.cellComp;\n }\n getValue() {\n return this.value;\n }\n getValueFormatted() {\n return this.valueFormatted;\n }\n addDomData() {\n const element = this.getGui();\n this.beans.gridOptionsService.setDomData(element, CellCtrl.DOM_DATA_KEY_CELL_CTRL, this);\n this.addDestroyFunc(() => this.beans.gridOptionsService.setDomData(element, CellCtrl.DOM_DATA_KEY_CELL_CTRL, null));\n }\n createEvent(domEvent, eventType) {\n const event = {\n type: eventType,\n node: this.rowNode,\n data: this.rowNode.data,\n value: this.value,\n column: this.column,\n colDef: this.column.getColDef(),\n context: this.beans.gridOptionsService.context,\n api: this.beans.gridApi,\n columnApi: this.beans.columnApi,\n rowPinned: this.rowNode.rowPinned,\n event: domEvent,\n rowIndex: this.rowNode.rowIndex\n };\n return event;\n }\n processCharacter(event) {\n var _a;\n (_a = this.cellKeyboardListenerFeature) === null || _a === void 0 ? void 0 : _a.processCharacter(event);\n }\n onKeyDown(event) {\n var _a;\n (_a = this.cellKeyboardListenerFeature) === null || _a === void 0 ? void 0 : _a.onKeyDown(event);\n }\n onMouseEvent(eventName, mouseEvent) {\n var _a;\n (_a = this.cellMouseListenerFeature) === null || _a === void 0 ? void 0 : _a.onMouseEvent(eventName, mouseEvent);\n }\n getGui() {\n return this.eGui;\n }\n refreshToolTip() {\n var _a;\n (_a = this.tooltipFeature) === null || _a === void 0 ? void 0 : _a.refreshToolTip();\n }\n getColSpanningList() {\n return this.cellPositionFeature.getColSpanningList();\n }\n onLeftChanged() {\n var _a;\n if (!this.cellComp) {\n return;\n }\n (_a = this.cellPositionFeature) === null || _a === void 0 ? void 0 : _a.onLeftChanged();\n }\n onDisplayedColumnsChanged() {\n if (!this.eGui) {\n return;\n }\n this.setAriaColIndex();\n }\n setAriaColIndex() {\n const colIdx = this.beans.columnModel.getAriaColumnIndex(this.column);\n setAriaColIndex(this.getGui(), colIdx); // for react, we don't use JSX, as it slowed down column moving\n }\n isSuppressNavigable() {\n return this.column.isSuppressNavigable(this.rowNode);\n }\n onWidthChanged() {\n var _a;\n return (_a = this.cellPositionFeature) === null || _a === void 0 ? void 0 : _a.onWidthChanged();\n }\n getColumn() {\n return this.column;\n }\n getRowNode() {\n return this.rowNode;\n }\n getBeans() {\n return this.beans;\n }\n isPrintLayout() {\n return this.printLayout;\n }\n appendChild(htmlElement) {\n this.eGui.appendChild(htmlElement);\n }\n refreshHandle() {\n if (this.cellRangeFeature) {\n this.cellRangeFeature.refreshHandle();\n }\n }\n getCellPosition() {\n return this.cellPosition;\n }\n isEditing() {\n return this.editing;\n }\n // called by rowRenderer when user navigates via tab key\n startRowOrCellEdit(key, event = null) {\n if (!this.cellComp) {\n return;\n }\n if (this.beans.gridOptionsService.get('editType') === 'fullRow') {\n this.rowCtrl.startRowEditing(key, this);\n }\n else {\n this.startEditing(key, true, event);\n }\n }\n getRowCtrl() {\n return this.rowCtrl;\n }\n getRowPosition() {\n return {\n rowIndex: this.cellPosition.rowIndex,\n rowPinned: this.cellPosition.rowPinned\n };\n }\n updateRangeBordersIfRangeCount() {\n if (!this.cellComp) {\n return;\n }\n if (this.cellRangeFeature) {\n this.cellRangeFeature.updateRangeBordersIfRangeCount();\n }\n }\n onRangeSelectionChanged() {\n if (!this.cellComp) {\n return;\n }\n if (this.cellRangeFeature) {\n this.cellRangeFeature.onRangeSelectionChanged();\n }\n }\n isRangeSelectionEnabled() {\n return this.cellRangeFeature != null;\n }\n focusCell(forceBrowserFocus = false) {\n this.beans.focusService.setFocusedCell({\n rowIndex: this.getCellPosition().rowIndex,\n column: this.column,\n rowPinned: this.rowNode.rowPinned,\n forceBrowserFocus\n });\n }\n onRowIndexChanged() {\n // when index changes, this influences items that need the index, so we update the\n // grid cell so they are working off the new index.\n this.createCellPosition();\n // when the index of the row changes, ie means the cell may have lost or gained focus\n this.onCellFocused();\n // check range selection\n if (this.cellRangeFeature) {\n this.cellRangeFeature.onRangeSelectionChanged();\n }\n }\n onFirstRightPinnedChanged() {\n if (!this.cellComp) {\n return;\n }\n const firstRightPinned = this.column.isFirstRightPinned();\n this.cellComp.addOrRemoveCssClass(CSS_CELL_FIRST_RIGHT_PINNED, firstRightPinned);\n }\n onLastLeftPinnedChanged() {\n if (!this.cellComp) {\n return;\n }\n const lastLeftPinned = this.column.isLastLeftPinned();\n this.cellComp.addOrRemoveCssClass(CSS_CELL_LAST_LEFT_PINNED, lastLeftPinned);\n }\n onCellFocused(event) {\n if (this.beans.gridOptionsService.is('suppressCellFocus')) {\n return;\n }\n const cellFocused = this.beans.focusService.isCellFocused(this.cellPosition);\n if (!this.cellComp) {\n if (cellFocused && (event === null || event === void 0 ? void 0 : event.forceBrowserFocus)) {\n // The cell comp has not been rendered yet, but the browser focus is being forced for this cell\n // so lets save the event to apply it when setComp is called in the next turn.\n this.focusEventToRestore = event;\n }\n return;\n }\n // Clear the saved focus event\n this.focusEventToRestore = undefined;\n this.cellComp.addOrRemoveCssClass(CSS_CELL_FOCUS, cellFocused);\n // see if we need to force browser focus - this can happen if focus is programmatically set\n if (cellFocused && event && event.forceBrowserFocus) {\n const focusEl = this.cellComp.getFocusableElement();\n focusEl.focus({ preventScroll: !!event.preventScrollOnBrowserFocus });\n }\n // if another cell was focused, and we are editing, then stop editing\n const fullRowEdit = this.beans.gridOptionsService.get('editType') === 'fullRow';\n if (!cellFocused && !fullRowEdit && this.editing) {\n this.stopRowOrCellEdit();\n }\n }\n createCellPosition() {\n this.cellPosition = {\n rowIndex: this.rowNode.rowIndex,\n rowPinned: makeNull(this.rowNode.rowPinned),\n column: this.column\n };\n }\n // CSS Classes that only get applied once, they never change\n applyStaticCssClasses() {\n this.cellComp.addOrRemoveCssClass(CSS_CELL, true);\n this.cellComp.addOrRemoveCssClass(CSS_CELL_NOT_INLINE_EDITING, true);\n // normal cells fill the height of the row. autoHeight cells have no height to let them\n // fit the height of content.\n const autoHeight = this.column.isAutoHeight() == true;\n this.cellComp.addOrRemoveCssClass(CSS_AUTO_HEIGHT, autoHeight);\n this.cellComp.addOrRemoveCssClass(CSS_NORMAL_HEIGHT, !autoHeight);\n }\n onColumnHover() {\n if (!this.cellComp) {\n return;\n }\n if (!this.beans.gridOptionsService.is('columnHoverHighlight')) {\n return;\n }\n const isHovered = this.beans.columnHoverService.isHovered(this.column);\n this.cellComp.addOrRemoveCssClass(CSS_COLUMN_HOVER, isHovered);\n }\n onColDefChanged() {\n if (!this.cellComp) {\n return;\n }\n this.setWrapText();\n if (!this.editing) {\n this.refreshCell({ forceRefresh: true, suppressFlash: true });\n }\n }\n setWrapText() {\n const value = this.column.getColDef().wrapText == true;\n this.cellComp.addOrRemoveCssClass(CSS_CELL_WRAP_TEXT, value);\n }\n dispatchCellContextMenuEvent(event) {\n const colDef = this.column.getColDef();\n const cellContextMenuEvent = this.createEvent(event, Events.EVENT_CELL_CONTEXT_MENU);\n this.beans.eventService.dispatchEvent(cellContextMenuEvent);\n if (colDef.onCellContextMenu) {\n // to make the callback async, do in a timeout\n window.setTimeout(() => colDef.onCellContextMenu(cellContextMenuEvent), 0);\n }\n }\n getCellRenderer() {\n return this.cellComp ? this.cellComp.getCellRenderer() : null;\n }\n getCellEditor() {\n return this.cellComp ? this.cellComp.getCellEditor() : null;\n }\n destroy() {\n this.onCellCompAttachedFuncs = [];\n super.destroy();\n }\n createSelectionCheckbox() {\n const cbSelectionComponent = new CheckboxSelectionComponent();\n this.beans.context.createBean(cbSelectionComponent);\n cbSelectionComponent.init({ rowNode: this.rowNode, column: this.column });\n // put the checkbox in before the value\n return cbSelectionComponent;\n }\n createDndSource() {\n const dndSourceComp = new DndSourceComp(this.rowNode, this.column, this.eGui);\n this.beans.context.createBean(dndSourceComp);\n return dndSourceComp;\n }\n registerRowDragger(customElement, dragStartPixels, suppressVisibilityChange) {\n // if previously existed, then we are only updating\n if (this.customRowDragComp) {\n this.customRowDragComp.setDragElement(customElement, dragStartPixels);\n return;\n }\n const newComp = this.createRowDragComp(customElement, dragStartPixels, suppressVisibilityChange);\n if (newComp) {\n this.customRowDragComp = newComp;\n this.addDestroyFunc(() => { this.beans.context.destroyBean(newComp); this.customRowDragComp = null; });\n }\n }\n createRowDragComp(customElement, dragStartPixels, suppressVisibilityChange) {\n const pagination = this.beans.gridOptionsService.is('pagination');\n const rowDragManaged = this.beans.gridOptionsService.is('rowDragManaged');\n const clientSideRowModelActive = this.beans.gridOptionsService.isRowModelType('clientSide');\n if (rowDragManaged) {\n // row dragging only available in default row model\n if (!clientSideRowModelActive) {\n doOnce(() => console.warn('AG Grid: managed row dragging is only allowed in the Client Side Row Model'), 'CellComp.addRowDragging');\n return;\n }\n if (pagination) {\n doOnce(() => console.warn('AG Grid: managed row dragging is not possible when doing pagination'), 'CellComp.addRowDragging');\n return;\n }\n }\n // otherwise (normal case) we are creating a RowDraggingComp for the first time\n const rowDragComp = new RowDragComp(() => this.value, this.rowNode, this.column, customElement, dragStartPixels, suppressVisibilityChange);\n this.beans.context.createBean(rowDragComp);\n return rowDragComp;\n }\n}\nCellCtrl.DOM_DATA_KEY_CELL_CTRL = 'cellCtrl';\n","import { BeanStub } from \"../../context/beanStub.mjs\";\nimport { RowNode } from \"../../entities/rowNode.mjs\";\nimport { RowHighlightPosition } from \"../../interfaces/iRowNode.mjs\";\nimport { Events } from \"../../events.mjs\";\nimport { RowContainerType } from \"../../gridBodyComp/rowContainer/rowContainerCtrl.mjs\";\nimport { ModuleNames } from \"../../modules/moduleNames.mjs\";\nimport { ModuleRegistry } from \"../../modules/moduleRegistry.mjs\";\nimport { setAriaExpanded, setAriaLabel, setAriaRowIndex, setAriaSelected } from \"../../utils/aria.mjs\";\nimport { isElementChildOfClass } from \"../../utils/dom.mjs\";\nimport { isStopPropagationForAgGrid } from \"../../utils/event.mjs\";\nimport { doOnce, executeNextVMTurn } from \"../../utils/function.mjs\";\nimport { exists, makeNull } from \"../../utils/generic.mjs\";\nimport { escapeString } from \"../../utils/string.mjs\";\nimport { CellCtrl } from \"../cell/cellCtrl.mjs\";\nimport { RowDragComp } from \"./rowDragComp.mjs\";\nvar RowType;\n(function (RowType) {\n RowType[\"Normal\"] = \"Normal\";\n RowType[\"FullWidth\"] = \"FullWidth\";\n RowType[\"FullWidthLoading\"] = \"FullWidthLoading\";\n RowType[\"FullWidthGroup\"] = \"FullWidthGroup\";\n RowType[\"FullWidthDetail\"] = \"FullWidthDetail\";\n})(RowType || (RowType = {}));\nlet instanceIdSequence = 0;\nexport class RowCtrl extends BeanStub {\n constructor(rowNode, beans, animateIn, useAnimationFrameForCreate, printLayout) {\n super();\n this.allRowGuis = [];\n this.active = true;\n this.centerCellCtrls = { list: [], map: {} };\n this.leftCellCtrls = { list: [], map: {} };\n this.rightCellCtrls = { list: [], map: {} };\n this.slideInAnimation = {\n left: false,\n center: false,\n right: false,\n fullWidth: false\n };\n this.fadeInAnimation = {\n left: false,\n center: false,\n right: false,\n fullWidth: false\n };\n this.lastMouseDownOnDragger = false;\n this.emptyStyle = {};\n this.updateColumnListsPending = false;\n this.rowId = null;\n this.businessKeySanitised = null;\n this.beans = beans;\n this.gridOptionsService = beans.gridOptionsService;\n this.rowNode = rowNode;\n this.paginationPage = beans.paginationProxy.getCurrentPage();\n this.useAnimationFrameForCreate = useAnimationFrameForCreate;\n this.printLayout = printLayout;\n this.instanceId = rowNode.id + '-' + instanceIdSequence++;\n this.rowId = escapeString(rowNode.id);\n if (this.isFullWidth() && !this.gridOptionsService.is('suppressCellFocus')) {\n this.tabIndex = -1;\n }\n this.setAnimateFlags(animateIn);\n this.initRowBusinessKey();\n this.rowFocused = beans.focusService.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned);\n this.rowLevel = beans.rowCssClassCalculator.calculateRowLevel(this.rowNode);\n this.setRowType();\n this.rowStyles = this.processStylesFromGridOptions();\n this.addListeners();\n }\n initRowBusinessKey() {\n this.businessKeyForNodeFunc = this.gridOptionsService.get('getBusinessKeyForNode');\n this.updateRowBusinessKey();\n }\n updateRowBusinessKey() {\n if (typeof this.businessKeyForNodeFunc !== 'function') {\n return;\n }\n const businessKey = this.businessKeyForNodeFunc(this.rowNode);\n this.businessKeySanitised = escapeString(businessKey);\n }\n getRowId() {\n return this.rowId;\n }\n getRowStyles() {\n return this.rowStyles;\n }\n getTabIndex() {\n return this.tabIndex;\n }\n isSticky() {\n return this.rowNode.sticky;\n }\n getBeans() {\n return this.beans;\n }\n getInstanceId() {\n return this.instanceId;\n }\n setComp(rowComp, element, containerType) {\n const gui = { rowComp, element, containerType };\n this.allRowGuis.push(gui);\n if (containerType === RowContainerType.LEFT) {\n this.leftGui = gui;\n }\n else if (containerType === RowContainerType.RIGHT) {\n this.rightGui = gui;\n }\n else if (containerType === RowContainerType.FULL_WIDTH) {\n this.fullWidthGui = gui;\n }\n else {\n this.centerGui = gui;\n }\n this.initialiseRowComp(gui);\n // pinned rows render before the main grid body in the SSRM, only fire the event after the main body has rendered.\n if (this.rowType !== 'FullWidthLoading' && !this.rowNode.rowPinned) {\n // this is fired within setComp as we know that the component renderer is now trying to render.\n // linked with the fact the function implementation queues behind requestAnimationFrame should allow\n // us to be certain that all rendering is done by the time the event fires.\n this.beans.rowRenderer.dispatchFirstDataRenderedEvent();\n }\n }\n unsetComp(containerType) {\n this.allRowGuis = this.allRowGuis\n .filter(rowGui => rowGui.containerType !== containerType);\n if (containerType === RowContainerType.LEFT) {\n this.leftGui = undefined;\n }\n else if (containerType === RowContainerType.RIGHT) {\n this.rightGui = undefined;\n }\n else if (containerType === RowContainerType.FULL_WIDTH) {\n this.fullWidthGui = undefined;\n }\n }\n isCacheable() {\n return this.rowType === RowType.FullWidthDetail\n && this.gridOptionsService.is('keepDetailRows');\n }\n setCached(cached) {\n const displayValue = cached ? 'none' : '';\n this.allRowGuis.forEach(rg => rg.element.style.display = displayValue);\n }\n initialiseRowComp(gui) {\n const gos = this.gridOptionsService;\n this.listenOnDomOrder(gui);\n this.onRowHeightChanged(gui);\n this.updateRowIndexes(gui);\n this.setFocusedClasses(gui);\n this.setStylesFromGridOptions(false, gui); // no need to calculate styles already set in constructor\n if (gos.isRowSelection() && this.rowNode.selectable) {\n this.onRowSelected(gui);\n }\n this.updateColumnLists(!this.useAnimationFrameForCreate);\n const comp = gui.rowComp;\n const initialRowClasses = this.getInitialRowClasses(gui.containerType);\n initialRowClasses.forEach(name => comp.addOrRemoveCssClass(name, true));\n this.executeSlideAndFadeAnimations(gui);\n if (this.rowNode.group) {\n setAriaExpanded(gui.element, this.rowNode.expanded == true);\n }\n this.setRowCompRowId(comp, false); // false = don't update the id, as we already set it\n this.setRowCompRowBusinessKey(comp);\n // DOM DATA\n gos.setDomData(gui.element, RowCtrl.DOM_DATA_KEY_ROW_CTRL, this);\n this.addDestroyFunc(() => gos.setDomData(gui.element, RowCtrl.DOM_DATA_KEY_ROW_CTRL, null));\n // adding hover functionality adds listener to this row, so we\n // do it lazily in an animation frame\n if (this.useAnimationFrameForCreate) {\n this.beans.animationFrameService.createTask(this.addHoverFunctionality.bind(this, gui.element), this.rowNode.rowIndex, 'createTasksP2');\n }\n else {\n this.addHoverFunctionality(gui.element);\n }\n if (this.isFullWidth()) {\n this.setupFullWidth(gui);\n }\n if (gos.is('rowDragEntireRow')) {\n this.addRowDraggerToRow(gui);\n }\n if (this.useAnimationFrameForCreate) {\n // the height animation we only want active after the row is alive for 1 second.\n // this stops the row animation working when rows are initially created. otherwise\n // auto-height rows get inserted into the dom and resized immediately, which gives\n // very bad UX (eg 10 rows get inserted, then all 10 expand, look particularly bad\n // when scrolling). so this makes sure when rows are shown for the first time, they\n // are resized immediately without animation.\n this.beans.animationFrameService.addDestroyTask(() => {\n if (!this.isAlive()) {\n return;\n }\n gui.rowComp.addOrRemoveCssClass('ag-after-created', true);\n });\n }\n this.executeProcessRowPostCreateFunc();\n }\n setRowCompRowBusinessKey(comp) {\n if (this.businessKeySanitised == null) {\n return;\n }\n comp.setRowBusinessKey(this.businessKeySanitised);\n }\n getBusinessKey() {\n return this.businessKeySanitised;\n }\n setRowCompRowId(comp, updateId) {\n if (updateId) {\n this.rowId = escapeString(this.rowNode.id);\n }\n if (this.rowId == null) {\n return;\n }\n comp.setRowId(this.rowId);\n }\n executeSlideAndFadeAnimations(gui) {\n const { containerType } = gui;\n const shouldSlide = this.slideInAnimation[containerType];\n if (shouldSlide) {\n executeNextVMTurn(() => {\n this.onTopChanged();\n });\n this.slideInAnimation[containerType] = false;\n }\n const shouldFade = this.fadeInAnimation[containerType];\n if (shouldFade) {\n executeNextVMTurn(() => {\n gui.rowComp.addOrRemoveCssClass('ag-opacity-zero', false);\n });\n this.fadeInAnimation[containerType] = false;\n }\n }\n addRowDraggerToRow(gui) {\n if (this.gridOptionsService.isEnableRangeSelection()) {\n doOnce(() => {\n console.warn('AG Grid: Setting `rowDragEntireRow: true` in the gridOptions doesn\\'t work with `enableRangeSelection: true`');\n }, 'rowDragAndRangeSelectionEnabled');\n return;\n }\n const translate = this.beans.localeService.getLocaleTextFunc();\n const rowDragComp = new RowDragComp(() => `1 ${translate('rowDragRow', 'row')}`, this.rowNode, undefined, gui.element, undefined, true);\n this.createManagedBean(rowDragComp, this.beans.context);\n }\n setupFullWidth(gui) {\n const pinned = this.getPinnedForContainer(gui.containerType);\n const params = this.createFullWidthParams(gui.element, pinned);\n if (this.rowType == RowType.FullWidthDetail) {\n if (!ModuleRegistry.__assertRegistered(ModuleNames.MasterDetailModule, \"cell renderer 'agDetailCellRenderer' (for master detail)\", this.beans.context.getGridId())) {\n return;\n }\n }\n let compDetails;\n switch (this.rowType) {\n case RowType.FullWidthDetail:\n compDetails = this.beans.userComponentFactory.getFullWidthDetailCellRendererDetails(params);\n break;\n case RowType.FullWidthGroup:\n compDetails = this.beans.userComponentFactory.getFullWidthGroupCellRendererDetails(params);\n break;\n case RowType.FullWidthLoading:\n compDetails = this.beans.userComponentFactory.getFullWidthLoadingCellRendererDetails(params);\n break;\n default:\n compDetails = this.beans.userComponentFactory.getFullWidthCellRendererDetails(params);\n break;\n }\n gui.rowComp.showFullWidth(compDetails);\n }\n isPrintLayout() {\n return this.printLayout;\n }\n getFullWidthCellRenderer() {\n var _a, _b;\n return (_b = (_a = this.fullWidthGui) === null || _a === void 0 ? void 0 : _a.rowComp) === null || _b === void 0 ? void 0 : _b.getFullWidthCellRenderer();\n }\n // use by autoWidthCalculator, as it clones the elements\n getCellElement(column) {\n const cellCtrl = this.getCellCtrl(column);\n return cellCtrl ? cellCtrl.getGui() : null;\n }\n executeProcessRowPostCreateFunc() {\n var _a;\n const func = this.gridOptionsService.getCallback('processRowPostCreate');\n if (!func || !this.areAllContainersReady()) {\n return;\n }\n const params = {\n eRow: (_a = this.centerGui) === null || _a === void 0 ? void 0 : _a.element,\n ePinnedLeftRow: this.leftGui ? this.leftGui.element : undefined,\n ePinnedRightRow: this.rightGui ? this.rightGui.element : undefined,\n node: this.rowNode,\n rowIndex: this.rowNode.rowIndex,\n addRenderedRowListener: this.addEventListener.bind(this),\n };\n func(params);\n }\n areAllContainersReady() {\n const isLeftReady = !!this.leftGui || !this.beans.columnModel.isPinningLeft();\n const isCenterReady = !!this.centerGui;\n const isRightReady = !!this.rightGui || !this.beans.columnModel.isPinningRight();\n return isLeftReady && isCenterReady && isRightReady;\n }\n setRowType() {\n const isStub = this.rowNode.stub;\n const isFullWidthCell = this.rowNode.isFullWidthCell();\n const isDetailCell = this.beans.doingMasterDetail && this.rowNode.detail;\n const pivotMode = this.beans.columnModel.isPivotMode();\n // we only use full width for groups, not footers. it wouldn't make sense to include footers if not looking\n // for totals. if users complain about this, then we should introduce a new property 'footerUseEntireRow'\n // so each can be set independently (as a customer complained about footers getting full width, hence\n // introducing this logic)\n const isGroupRow = !!this.rowNode.group && !this.rowNode.footer;\n const isFullWidthGroup = isGroupRow && this.gridOptionsService.isGroupUseEntireRow(pivotMode);\n if (isStub) {\n this.rowType = RowType.FullWidthLoading;\n }\n else if (isDetailCell) {\n this.rowType = RowType.FullWidthDetail;\n }\n else if (isFullWidthCell) {\n this.rowType = RowType.FullWidth;\n }\n else if (isFullWidthGroup) {\n this.rowType = RowType.FullWidthGroup;\n }\n else {\n this.rowType = RowType.Normal;\n }\n }\n updateColumnLists(suppressAnimationFrame = false, useFlushSync = false) {\n if (this.isFullWidth()) {\n return;\n }\n const noAnimation = suppressAnimationFrame\n || this.gridOptionsService.is('suppressAnimationFrame')\n || this.printLayout;\n if (noAnimation) {\n this.updateColumnListsImpl(useFlushSync);\n return;\n }\n if (this.updateColumnListsPending) {\n return;\n }\n this.beans.animationFrameService.createTask(() => {\n if (!this.active) {\n return;\n }\n this.updateColumnListsImpl(true);\n }, this.rowNode.rowIndex, 'createTasksP1');\n this.updateColumnListsPending = true;\n }\n createCellCtrls(prev, cols, pinned = null) {\n const res = {\n list: [],\n map: {}\n };\n const addCell = (colInstanceId, cellCtrl) => {\n res.list.push(cellCtrl);\n res.map[colInstanceId] = cellCtrl;\n };\n cols.forEach(col => {\n // we use instanceId's rather than colId as it's possible there is a Column with same Id,\n // but it's referring to a different column instance. Happens a lot with pivot, as pivot col id's are\n // reused eg pivot_0, pivot_1 etc\n const colInstanceId = col.getInstanceId();\n let cellCtrl = prev.map[colInstanceId];\n if (!cellCtrl) {\n cellCtrl = new CellCtrl(col, this.rowNode, this.beans, this);\n }\n addCell(colInstanceId, cellCtrl);\n });\n prev.list.forEach(prevCellCtrl => {\n const cellInResult = res.map[prevCellCtrl.getColumn().getInstanceId()] != null;\n if (cellInResult) {\n return;\n }\n const keepCell = !this.isCellEligibleToBeRemoved(prevCellCtrl, pinned);\n if (keepCell) {\n addCell(prevCellCtrl.getColumn().getInstanceId(), prevCellCtrl);\n return;\n }\n prevCellCtrl.destroy();\n });\n return res;\n }\n updateColumnListsImpl(useFlushSync) {\n this.updateColumnListsPending = false;\n this.createAllCellCtrls();\n this.setCellCtrls(useFlushSync);\n }\n setCellCtrls(useFlushSync) {\n this.allRowGuis.forEach(item => {\n const cellControls = this.getCellCtrlsForContainer(item.containerType);\n item.rowComp.setCellCtrls(cellControls, useFlushSync);\n });\n }\n getCellCtrlsForContainer(containerType) {\n switch (containerType) {\n case RowContainerType.LEFT:\n return this.leftCellCtrls.list;\n case RowContainerType.RIGHT:\n return this.rightCellCtrls.list;\n case RowContainerType.FULL_WIDTH:\n return [];\n case RowContainerType.CENTER:\n return this.centerCellCtrls.list;\n default:\n const exhaustiveCheck = containerType;\n throw new Error(`Unhandled case: ${exhaustiveCheck}`);\n }\n }\n createAllCellCtrls() {\n const columnModel = this.beans.columnModel;\n if (this.printLayout) {\n this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, columnModel.getAllDisplayedColumns());\n this.leftCellCtrls = { list: [], map: {} };\n this.rightCellCtrls = { list: [], map: {} };\n }\n else {\n const centerCols = columnModel.getViewportCenterColumnsForRow(this.rowNode);\n this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, centerCols);\n const leftCols = columnModel.getDisplayedLeftColumnsForRow(this.rowNode);\n this.leftCellCtrls = this.createCellCtrls(this.leftCellCtrls, leftCols, 'left');\n const rightCols = columnModel.getDisplayedRightColumnsForRow(this.rowNode);\n this.rightCellCtrls = this.createCellCtrls(this.rightCellCtrls, rightCols, 'right');\n }\n }\n isCellEligibleToBeRemoved(cellCtrl, nextContainerPinned) {\n const REMOVE_CELL = true;\n const KEEP_CELL = false;\n // always remove the cell if it's not rendered or if it's in the wrong pinned location\n const column = cellCtrl.getColumn();\n if (column.getPinned() != nextContainerPinned) {\n return REMOVE_CELL;\n }\n // we want to try and keep editing and focused cells\n const editing = cellCtrl.isEditing();\n const focused = this.beans.focusService.isCellFocused(cellCtrl.getCellPosition());\n const mightWantToKeepCell = editing || focused;\n if (mightWantToKeepCell) {\n const column = cellCtrl.getColumn();\n const displayedColumns = this.beans.columnModel.getAllDisplayedColumns();\n const cellStillDisplayed = displayedColumns.indexOf(column) >= 0;\n return cellStillDisplayed ? KEEP_CELL : REMOVE_CELL;\n }\n return REMOVE_CELL;\n }\n getDomOrder() {\n const isEnsureDomOrder = this.gridOptionsService.is('ensureDomOrder');\n return isEnsureDomOrder || this.gridOptionsService.isDomLayout('print');\n }\n listenOnDomOrder(gui) {\n const listener = () => {\n gui.rowComp.setDomOrder(this.getDomOrder());\n };\n this.addManagedPropertyListener('domLayout', listener);\n this.addManagedPropertyListener('ensureDomOrder', listener);\n }\n setAnimateFlags(animateIn) {\n if (this.isSticky() || !animateIn) {\n return;\n }\n const oldRowTopExists = exists(this.rowNode.oldRowTop);\n const pinningLeft = this.beans.columnModel.isPinningLeft();\n const pinningRight = this.beans.columnModel.isPinningRight();\n if (oldRowTopExists) {\n // if the row had a previous position, we slide it in\n this.slideInAnimation.center = true;\n this.slideInAnimation.left = pinningLeft;\n this.slideInAnimation.right = pinningRight;\n }\n else {\n // if the row had no previous position, we fade it in\n this.fadeInAnimation.center = true;\n this.fadeInAnimation.left = pinningLeft;\n this.fadeInAnimation.right = pinningRight;\n }\n }\n isEditing() {\n return this.editingRow;\n }\n stopRowEditing(cancel) {\n this.stopEditing(cancel);\n }\n isFullWidth() {\n return this.rowType !== RowType.Normal;\n }\n getRowType() {\n return this.rowType;\n }\n refreshFullWidth() {\n // returns 'true' if refresh succeeded\n const tryRefresh = (gui, pinned) => {\n if (!gui) {\n return true;\n } // no refresh needed\n const cellRenderer = gui.rowComp.getFullWidthCellRenderer();\n // no cell renderer, either means comp not yet ready, or comp ready but now reference\n // to it (happens in react when comp is stateless). if comp not ready, we don't need to\n // refresh, however we don't know which one, so we refresh to cover the case where it's\n // react comp without reference so need to force a refresh\n if (!cellRenderer) {\n return false;\n }\n // no refresh method present, so can't refresh, hard refresh needed\n if (!cellRenderer.refresh) {\n return false;\n }\n const params = this.createFullWidthParams(gui.element, pinned);\n const refreshSucceeded = cellRenderer.refresh(params);\n return refreshSucceeded;\n };\n const fullWidthSuccess = tryRefresh(this.fullWidthGui, null);\n const centerSuccess = tryRefresh(this.centerGui, null);\n const leftSuccess = tryRefresh(this.leftGui, 'left');\n const rightSuccess = tryRefresh(this.rightGui, 'right');\n const allFullWidthRowsRefreshed = fullWidthSuccess && centerSuccess && leftSuccess && rightSuccess;\n return allFullWidthRowsRefreshed;\n }\n addListeners() {\n this.addManagedListener(this.rowNode, RowNode.EVENT_HEIGHT_CHANGED, () => this.onRowHeightChanged());\n this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_SELECTED, () => this.onRowSelected());\n this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_INDEX_CHANGED, this.onRowIndexChanged.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_TOP_CHANGED, this.onTopChanged.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_EXPANDED_CHANGED, this.updateExpandedCss.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_HAS_CHILDREN_CHANGED, this.updateExpandedCss.bind(this));\n if (this.rowNode.detail) {\n // if the master row node has updated data, we also want to try to refresh the detail row\n this.addManagedListener(this.rowNode.parent, RowNode.EVENT_DATA_CHANGED, this.onRowNodeDataChanged.bind(this));\n }\n this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.onRowNodeDataChanged.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.onRowNodeCellChanged.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_HIGHLIGHT_CHANGED, this.onRowNodeHighlightChanged.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_DRAGGING_CHANGED, this.onRowNodeDraggingChanged.bind(this));\n this.addManagedListener(this.rowNode, RowNode.EVENT_UI_LEVEL_CHANGED, this.onUiLevelChanged.bind(this));\n const eventService = this.beans.eventService;\n this.addManagedListener(eventService, Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED, this.onPaginationPixelOffsetChanged.bind(this));\n this.addManagedListener(eventService, Events.EVENT_HEIGHT_SCALE_CHANGED, this.onTopChanged.bind(this));\n this.addManagedListener(eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));\n this.addManagedListener(eventService, Events.EVENT_VIRTUAL_COLUMNS_CHANGED, this.onVirtualColumnsChanged.bind(this));\n this.addManagedListener(eventService, Events.EVENT_CELL_FOCUSED, this.onCellFocused.bind(this));\n this.addManagedListener(eventService, Events.EVENT_CELL_FOCUS_CLEARED, this.onCellFocusCleared.bind(this));\n this.addManagedListener(eventService, Events.EVENT_PAGINATION_CHANGED, this.onPaginationChanged.bind(this));\n this.addManagedListener(eventService, Events.EVENT_MODEL_UPDATED, this.onModelUpdated.bind(this));\n this.addManagedListener(eventService, Events.EVENT_COLUMN_MOVED, this.onColumnMoved.bind(this));\n this.addListenersForCellComps();\n }\n onColumnMoved() {\n this.updateColumnLists();\n }\n addListenersForCellComps() {\n this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_INDEX_CHANGED, () => {\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.onRowIndexChanged());\n });\n this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, event => {\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.onCellChanged(event));\n });\n }\n onRowNodeDataChanged(event) {\n if (this.isFullWidth()) {\n const refresh = this.refreshFullWidth();\n if (!refresh) {\n this.beans.rowRenderer.redrawRow(this.rowNode);\n }\n return;\n }\n // if this is an update, we want to refresh, as this will allow the user to put in a transition\n // into the cellRenderer refresh method. otherwise this might be completely new data, in which case\n // we will want to completely replace the cells\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.refreshCell({\n suppressFlash: !event.update,\n newData: !event.update\n }));\n // as data has changed update the dom row id attributes\n this.allRowGuis.forEach(gui => {\n this.setRowCompRowId(gui.rowComp, true);\n this.updateRowBusinessKey();\n this.setRowCompRowBusinessKey(gui.rowComp);\n });\n // check for selected also, as this could be after lazy loading of the row data, in which case\n // the id might of just gotten set inside the row and the row selected state may of changed\n // as a result. this is what happens when selected rows are loaded in virtual pagination.\n // - niall note - since moving to the stub component, this may no longer be true, as replacing\n // the stub component now replaces the entire row\n this.onRowSelected();\n // as data has changed, then the style and class needs to be recomputed\n this.postProcessCss();\n }\n onRowNodeCellChanged() {\n // as data has changed, then the style and class needs to be recomputed\n this.postProcessCss();\n }\n postProcessCss() {\n this.setStylesFromGridOptions(true);\n this.postProcessClassesFromGridOptions();\n this.postProcessRowClassRules();\n this.postProcessRowDragging();\n }\n onRowNodeHighlightChanged() {\n const highlighted = this.rowNode.highlighted;\n this.allRowGuis.forEach(gui => {\n const aboveOn = highlighted === RowHighlightPosition.Above;\n const belowOn = highlighted === RowHighlightPosition.Below;\n gui.rowComp.addOrRemoveCssClass('ag-row-highlight-above', aboveOn);\n gui.rowComp.addOrRemoveCssClass('ag-row-highlight-below', belowOn);\n });\n }\n onRowNodeDraggingChanged() {\n this.postProcessRowDragging();\n }\n postProcessRowDragging() {\n const dragging = this.rowNode.dragging;\n this.allRowGuis.forEach(gui => gui.rowComp.addOrRemoveCssClass('ag-row-dragging', dragging));\n }\n updateExpandedCss() {\n const expandable = this.rowNode.isExpandable();\n const expanded = this.rowNode.expanded == true;\n this.allRowGuis.forEach(gui => {\n gui.rowComp.addOrRemoveCssClass('ag-row-group', expandable);\n gui.rowComp.addOrRemoveCssClass('ag-row-group-expanded', expandable && expanded);\n gui.rowComp.addOrRemoveCssClass('ag-row-group-contracted', expandable && !expanded);\n setAriaExpanded(gui.element, expandable && expanded);\n });\n }\n onDisplayedColumnsChanged() {\n // we skip animations for onDisplayedColumnChanged, as otherwise the client could remove columns and\n // then set data, and any old valueGetter's (ie from cols that were removed) would still get called.\n this.updateColumnLists(true);\n if (this.beans.columnModel.wasAutoRowHeightEverActive()) {\n this.rowNode.checkAutoHeights();\n }\n }\n onVirtualColumnsChanged() {\n this.updateColumnLists(false, true);\n }\n getRowPosition() {\n return {\n rowPinned: makeNull(this.rowNode.rowPinned),\n rowIndex: this.rowNode.rowIndex\n };\n }\n onKeyboardNavigate(keyboardEvent) {\n const currentFullWidthComp = this.allRowGuis.find(c => c.element.contains(keyboardEvent.target));\n const currentFullWidthContainer = currentFullWidthComp ? currentFullWidthComp.element : null;\n const isFullWidthContainerFocused = currentFullWidthContainer === keyboardEvent.target;\n if (!isFullWidthContainerFocused) {\n return;\n }\n const node = this.rowNode;\n const lastFocusedCell = this.beans.focusService.getFocusedCell();\n const cellPosition = {\n rowIndex: node.rowIndex,\n rowPinned: node.rowPinned,\n column: (lastFocusedCell && lastFocusedCell.column)\n };\n this.beans.navigationService.navigateToNextCell(keyboardEvent, keyboardEvent.key, cellPosition, true);\n keyboardEvent.preventDefault();\n }\n onTabKeyDown(keyboardEvent) {\n if (keyboardEvent.defaultPrevented || isStopPropagationForAgGrid(keyboardEvent)) {\n return;\n }\n const currentFullWidthComp = this.allRowGuis.find(c => c.element.contains(keyboardEvent.target));\n const currentFullWidthContainer = currentFullWidthComp ? currentFullWidthComp.element : null;\n const isFullWidthContainerFocused = currentFullWidthContainer === keyboardEvent.target;\n let nextEl = null;\n if (!isFullWidthContainerFocused) {\n nextEl = this.beans.focusService.findNextFocusableElement(currentFullWidthContainer, false, keyboardEvent.shiftKey);\n }\n if ((this.isFullWidth() && isFullWidthContainerFocused) || !nextEl) {\n this.beans.navigationService.onTabKeyDown(this, keyboardEvent);\n }\n }\n onFullWidthRowFocused(event) {\n var _a;\n const node = this.rowNode;\n const isFocused = !event ? false : this.isFullWidth() && event.rowIndex === node.rowIndex && event.rowPinned == node.rowPinned;\n const element = this.fullWidthGui ? this.fullWidthGui.element : (_a = this.centerGui) === null || _a === void 0 ? void 0 : _a.element;\n if (!element) {\n return;\n } // can happen with react ui, comp not yet ready\n element.classList.toggle('ag-full-width-focus', isFocused);\n if (isFocused) {\n // we don't scroll normal rows into view when we focus them, so we don't want\n // to scroll Full Width rows either.\n element.focus({ preventScroll: true });\n }\n }\n refreshCell(cellCtrl) {\n this.centerCellCtrls = this.removeCellCtrl(this.centerCellCtrls, cellCtrl);\n this.leftCellCtrls = this.removeCellCtrl(this.leftCellCtrls, cellCtrl);\n this.rightCellCtrls = this.removeCellCtrl(this.rightCellCtrls, cellCtrl);\n this.updateColumnLists();\n }\n removeCellCtrl(prev, cellCtrlToRemove) {\n const res = {\n list: [],\n map: {}\n };\n prev.list.forEach(cellCtrl => {\n if (cellCtrl === cellCtrlToRemove) {\n return;\n }\n res.list.push(cellCtrl);\n res.map[cellCtrl.getInstanceId()] = cellCtrl;\n });\n return res;\n }\n onMouseEvent(eventName, mouseEvent) {\n switch (eventName) {\n case 'dblclick':\n this.onRowDblClick(mouseEvent);\n break;\n case 'click':\n this.onRowClick(mouseEvent);\n break;\n case 'touchstart':\n case 'mousedown':\n this.onRowMouseDown(mouseEvent);\n break;\n }\n }\n createRowEvent(type, domEvent) {\n return {\n type: type,\n node: this.rowNode,\n data: this.rowNode.data,\n rowIndex: this.rowNode.rowIndex,\n rowPinned: this.rowNode.rowPinned,\n context: this.gridOptionsService.context,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n event: domEvent\n };\n }\n createRowEventWithSource(type, domEvent) {\n const event = this.createRowEvent(type, domEvent);\n // when first developing this, we included the rowComp in the event.\n // this seems very weird. so when introducing the event types, i left the 'source'\n // out of the type, and just include the source in the two places where this event\n // was fired (rowClicked and rowDoubleClicked). it doesn't make sense for any\n // users to be using this, as the rowComp isn't an object we expose, so would be\n // very surprising if a user was using it.\n event.source = this;\n return event;\n }\n onRowDblClick(mouseEvent) {\n if (isStopPropagationForAgGrid(mouseEvent)) {\n return;\n }\n const agEvent = this.createRowEventWithSource(Events.EVENT_ROW_DOUBLE_CLICKED, mouseEvent);\n this.beans.eventService.dispatchEvent(agEvent);\n }\n onRowMouseDown(mouseEvent) {\n this.lastMouseDownOnDragger = isElementChildOfClass(mouseEvent.target, 'ag-row-drag', 3);\n if (!this.isFullWidth()) {\n return;\n }\n const node = this.rowNode;\n const columnModel = this.beans.columnModel;\n if (this.beans.rangeService) {\n this.beans.rangeService.removeAllCellRanges();\n }\n this.beans.focusService.setFocusedCell({\n rowIndex: node.rowIndex,\n column: columnModel.getAllDisplayedColumns()[0],\n rowPinned: node.rowPinned,\n forceBrowserFocus: true\n });\n }\n onRowClick(mouseEvent) {\n const stop = isStopPropagationForAgGrid(mouseEvent) || this.lastMouseDownOnDragger;\n if (stop) {\n return;\n }\n const agEvent = this.createRowEventWithSource(Events.EVENT_ROW_CLICKED, mouseEvent);\n this.beans.eventService.dispatchEvent(agEvent);\n // ctrlKey for windows, metaKey for Apple\n const isMultiKey = mouseEvent.ctrlKey || mouseEvent.metaKey;\n const isShiftKey = mouseEvent.shiftKey;\n // we do not allow selecting the group by clicking, when groupSelectChildren, as the logic to\n // handle this is broken. to observe, change the logic below and allow groups to be selected.\n // you will see the group gets selected, then all children get selected, then the grid unselects\n // the children (as the default behaviour when clicking is to unselect other rows) which results\n // in the group getting unselected (as all children are unselected). the correct thing would be\n // to change this, so that children of the selected group are not then subsequently un-selected.\n const groupSelectsChildren = this.gridOptionsService.is('groupSelectsChildren');\n if (\n // we do not allow selecting groups by clicking (as the click here expands the group), or if it's a detail row,\n // so return if it's a group row\n (groupSelectsChildren && this.rowNode.group) ||\n // this is needed so we don't unselect other rows when we click this row, eg if this row is not selectable,\n // and we click it, the selection should not change (ie any currently selected row should stay selected)\n !this.rowNode.selectable ||\n // we also don't allow selection of pinned rows\n this.rowNode.rowPinned ||\n // if no selection method enabled, do nothing\n !this.gridOptionsService.isRowSelection() ||\n // if click selection suppressed, do nothing\n this.gridOptionsService.is('suppressRowClickSelection')) {\n return;\n }\n const multiSelectOnClick = this.gridOptionsService.is('rowMultiSelectWithClick');\n const rowDeselectionWithCtrl = !this.gridOptionsService.is('suppressRowDeselection');\n const source = 'rowClicked';\n if (this.rowNode.isSelected()) {\n if (multiSelectOnClick) {\n this.rowNode.setSelectedParams({ newValue: false, event: mouseEvent, source });\n }\n else if (isMultiKey) {\n if (rowDeselectionWithCtrl) {\n this.rowNode.setSelectedParams({ newValue: false, event: mouseEvent, source });\n }\n }\n else {\n // selected with no multi key, must make sure anything else is unselected\n this.rowNode.setSelectedParams({ newValue: true, clearSelection: !isShiftKey, rangeSelect: isShiftKey, event: mouseEvent, source });\n }\n }\n else {\n const clearSelection = multiSelectOnClick ? false : !isMultiKey;\n this.rowNode.setSelectedParams({ newValue: true, clearSelection: clearSelection, rangeSelect: isShiftKey, event: mouseEvent, source });\n }\n }\n setupDetailRowAutoHeight(eDetailGui) {\n if (this.rowType !== RowType.FullWidthDetail) {\n return;\n }\n if (!this.gridOptionsService.is('detailRowAutoHeight')) {\n return;\n }\n const checkRowSizeFunc = () => {\n const clientHeight = eDetailGui.clientHeight;\n // if the UI is not ready, the height can be 0, which we ignore, as otherwise a flicker will occur\n // as UI goes from the default height, to 0, then to the real height as UI becomes ready. this means\n // it's not possible for have 0 as auto-height, however this is an improbable use case, as even an\n // empty detail grid would still have some styling around it giving at least a few pixels.\n if (clientHeight != null && clientHeight > 0) {\n // we do the update in a timeout, to make sure we are not calling from inside the grid\n // doing another update\n const updateRowHeightFunc = () => {\n this.rowNode.setRowHeight(clientHeight);\n if (this.beans.clientSideRowModel) {\n this.beans.clientSideRowModel.onRowHeightChanged();\n }\n else if (this.beans.serverSideRowModel) {\n this.beans.serverSideRowModel.onRowHeightChanged();\n }\n };\n this.beans.frameworkOverrides.setTimeout(updateRowHeightFunc, 0);\n }\n };\n const resizeObserverDestroyFunc = this.beans.resizeObserverService.observeResize(eDetailGui, checkRowSizeFunc);\n this.addDestroyFunc(resizeObserverDestroyFunc);\n checkRowSizeFunc();\n }\n createFullWidthParams(eRow, pinned) {\n const params = {\n fullWidth: true,\n data: this.rowNode.data,\n node: this.rowNode,\n value: this.rowNode.key,\n valueFormatted: this.rowNode.key,\n rowIndex: this.rowNode.rowIndex,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context,\n // these need to be taken out, as part of 'afterAttached' now\n eGridCell: eRow,\n eParentOfValue: eRow,\n pinned: pinned,\n addRenderedRowListener: this.addEventListener.bind(this),\n registerRowDragger: (rowDraggerElement, dragStartPixels, value, suppressVisibilityChange) => this.addFullWidthRowDragging(rowDraggerElement, dragStartPixels, value, suppressVisibilityChange)\n };\n return params;\n }\n addFullWidthRowDragging(rowDraggerElement, dragStartPixels, value = '', suppressVisibilityChange) {\n if (!this.isFullWidth()) {\n return;\n }\n const rowDragComp = new RowDragComp(() => value, this.rowNode, undefined, rowDraggerElement, dragStartPixels, suppressVisibilityChange);\n this.createManagedBean(rowDragComp, this.beans.context);\n }\n onUiLevelChanged() {\n const newLevel = this.beans.rowCssClassCalculator.calculateRowLevel(this.rowNode);\n if (this.rowLevel != newLevel) {\n const classToAdd = 'ag-row-level-' + newLevel;\n const classToRemove = 'ag-row-level-' + this.rowLevel;\n this.allRowGuis.forEach(gui => {\n gui.rowComp.addOrRemoveCssClass(classToAdd, true);\n gui.rowComp.addOrRemoveCssClass(classToRemove, false);\n });\n }\n this.rowLevel = newLevel;\n }\n isFirstRowOnPage() {\n return this.rowNode.rowIndex === this.beans.paginationProxy.getPageFirstRow();\n }\n isLastRowOnPage() {\n return this.rowNode.rowIndex === this.beans.paginationProxy.getPageLastRow();\n }\n onModelUpdated() {\n this.refreshFirstAndLastRowStyles();\n }\n refreshFirstAndLastRowStyles() {\n const newFirst = this.isFirstRowOnPage();\n const newLast = this.isLastRowOnPage();\n if (this.firstRowOnPage !== newFirst) {\n this.firstRowOnPage = newFirst;\n this.allRowGuis.forEach(gui => gui.rowComp.addOrRemoveCssClass('ag-row-first', newFirst));\n }\n if (this.lastRowOnPage !== newLast) {\n this.lastRowOnPage = newLast;\n this.allRowGuis.forEach(gui => gui.rowComp.addOrRemoveCssClass('ag-row-last', newLast));\n }\n }\n stopEditing(cancel = false) {\n // if we are already stopping row edit, there is\n // no need to start this process again.\n if (this.stoppingRowEdit) {\n return;\n }\n const cellControls = this.getAllCellCtrls();\n const isRowEdit = this.editingRow;\n this.stoppingRowEdit = true;\n let fireRowEditEvent = false;\n for (const ctrl of cellControls) {\n const valueChanged = ctrl.stopEditing(cancel);\n if (isRowEdit && !cancel && !fireRowEditEvent && valueChanged) {\n fireRowEditEvent = true;\n }\n }\n if (fireRowEditEvent) {\n const event = this.createRowEvent(Events.EVENT_ROW_VALUE_CHANGED);\n this.beans.eventService.dispatchEvent(event);\n }\n if (isRowEdit) {\n this.setEditingRow(false);\n }\n this.stoppingRowEdit = false;\n }\n setInlineEditingCss(editing) {\n this.allRowGuis.forEach(gui => {\n gui.rowComp.addOrRemoveCssClass(\"ag-row-inline-editing\", editing);\n gui.rowComp.addOrRemoveCssClass(\"ag-row-not-inline-editing\", !editing);\n });\n }\n setEditingRow(value) {\n this.editingRow = value;\n this.allRowGuis.forEach(gui => gui.rowComp.addOrRemoveCssClass('ag-row-editing', value));\n const event = value ?\n this.createRowEvent(Events.EVENT_ROW_EDITING_STARTED)\n : this.createRowEvent(Events.EVENT_ROW_EDITING_STOPPED);\n this.beans.eventService.dispatchEvent(event);\n }\n startRowEditing(key = null, sourceRenderedCell = null, event = null) {\n // don't do it if already editing\n if (this.editingRow) {\n return;\n }\n const atLeastOneEditing = this.getAllCellCtrls().reduce((prev, cellCtrl) => {\n const cellStartedEdit = cellCtrl === sourceRenderedCell;\n if (cellStartedEdit) {\n cellCtrl.startEditing(key, cellStartedEdit, event);\n }\n else {\n cellCtrl.startEditing(null, cellStartedEdit, event);\n }\n if (prev) {\n return true;\n }\n return cellCtrl.isEditing();\n }, false);\n if (atLeastOneEditing) {\n this.setEditingRow(true);\n }\n }\n getAllCellCtrls() {\n if (this.leftCellCtrls.list.length === 0 && this.rightCellCtrls.list.length === 0) {\n return this.centerCellCtrls.list;\n }\n const res = [...this.centerCellCtrls.list, ...this.leftCellCtrls.list, ...this.rightCellCtrls.list];\n return res;\n }\n postProcessClassesFromGridOptions() {\n const cssClasses = this.beans.rowCssClassCalculator.processClassesFromGridOptions(this.rowNode);\n if (!cssClasses || !cssClasses.length) {\n return;\n }\n cssClasses.forEach(classStr => {\n this.allRowGuis.forEach(c => c.rowComp.addOrRemoveCssClass(classStr, true));\n });\n }\n postProcessRowClassRules() {\n this.beans.rowCssClassCalculator.processRowClassRules(this.rowNode, (className) => {\n this.allRowGuis.forEach(gui => gui.rowComp.addOrRemoveCssClass(className, true));\n }, (className) => {\n this.allRowGuis.forEach(gui => gui.rowComp.addOrRemoveCssClass(className, false));\n });\n }\n setStylesFromGridOptions(updateStyles, gui) {\n if (updateStyles) {\n this.rowStyles = this.processStylesFromGridOptions();\n }\n this.forEachGui(gui, gui => gui.rowComp.setUserStyles(this.rowStyles));\n }\n getPinnedForContainer(rowContainerType) {\n const pinned = rowContainerType === RowContainerType.LEFT\n ? 'left'\n : rowContainerType === RowContainerType.RIGHT\n ? 'right'\n : null;\n return pinned;\n }\n getInitialRowClasses(rowContainerType) {\n const pinned = this.getPinnedForContainer(rowContainerType);\n const params = {\n rowNode: this.rowNode,\n rowFocused: this.rowFocused,\n fadeRowIn: this.fadeInAnimation[rowContainerType],\n rowIsEven: this.rowNode.rowIndex % 2 === 0,\n rowLevel: this.rowLevel,\n fullWidthRow: this.isFullWidth(),\n firstRowOnPage: this.isFirstRowOnPage(),\n lastRowOnPage: this.isLastRowOnPage(),\n printLayout: this.printLayout,\n expandable: this.rowNode.isExpandable(),\n pinned: pinned\n };\n return this.beans.rowCssClassCalculator.getInitialRowClasses(params);\n }\n processStylesFromGridOptions() {\n // part 1 - rowStyle\n const rowStyle = this.gridOptionsService.get('rowStyle');\n if (rowStyle && typeof rowStyle === 'function') {\n console.warn('AG Grid: rowStyle should be an object of key/value styles, not be a function, use getRowStyle() instead');\n return;\n }\n // part 1 - rowStyleFunc\n const rowStyleFunc = this.gridOptionsService.getCallback('getRowStyle');\n let rowStyleFuncResult;\n if (rowStyleFunc) {\n const params = {\n data: this.rowNode.data,\n node: this.rowNode,\n rowIndex: this.rowNode.rowIndex\n };\n rowStyleFuncResult = rowStyleFunc(params);\n }\n if (rowStyleFuncResult || rowStyle) {\n return Object.assign({}, rowStyle, rowStyleFuncResult);\n }\n // Return constant reference for React\n return this.emptyStyle;\n }\n onRowSelected(gui) {\n // Treat undefined as false, if we pass undefined down it gets treated as toggle class, rather than explicitly\n // setting the required value\n const selected = !!this.rowNode.isSelected();\n this.forEachGui(gui, gui => {\n gui.rowComp.addOrRemoveCssClass('ag-row-selected', selected);\n setAriaSelected(gui.element, selected ? true : undefined);\n const ariaLabel = this.createAriaLabel();\n setAriaLabel(gui.element, ariaLabel == null ? '' : ariaLabel);\n });\n }\n createAriaLabel() {\n const selected = this.rowNode.isSelected();\n if (selected && this.gridOptionsService.is('suppressRowDeselection')) {\n return undefined;\n }\n const translate = this.beans.localeService.getLocaleTextFunc();\n const label = translate(selected ? 'ariaRowDeselect' : 'ariaRowSelect', `Press SPACE to ${selected ? 'deselect' : 'select'} this row.`);\n return label;\n }\n isUseAnimationFrameForCreate() {\n return this.useAnimationFrameForCreate;\n }\n addHoverFunctionality(eRow) {\n // because we use animation frames to do this, it's possible the row no longer exists\n // by the time we get to add it\n if (!this.active) {\n return;\n }\n // because mouseenter and mouseleave do not propagate, we cannot listen on the gridPanel\n // like we do for all the other mouse events.\n // because of the pinning, we cannot simply add / remove the class based on the eRow. we\n // have to check all eRow's (body & pinned). so the trick is if any of the rows gets a\n // mouse hover, it sets such in the rowNode, and then all three reflect the change as\n // all are listening for event on the row node.\n // step 1 - add listener, to set flag on row node\n this.addManagedListener(eRow, 'mouseenter', () => this.rowNode.onMouseEnter());\n this.addManagedListener(eRow, 'mouseleave', () => this.rowNode.onMouseLeave());\n // step 2 - listen for changes on row node (which any eRow can trigger)\n this.addManagedListener(this.rowNode, RowNode.EVENT_MOUSE_ENTER, () => {\n // if hover turned off, we don't add the class. we do this here so that if the application\n // toggles this property mid way, we remove the hover form the last row, but we stop\n // adding hovers from that point onwards. Also, do not highlight while dragging elements around.\n if (!this.beans.dragService.isDragging() &&\n !this.gridOptionsService.is('suppressRowHoverHighlight')) {\n eRow.classList.add('ag-row-hover');\n this.rowNode.setHovered(true);\n }\n });\n this.addManagedListener(this.rowNode, RowNode.EVENT_MOUSE_LEAVE, () => {\n eRow.classList.remove('ag-row-hover');\n this.rowNode.setHovered(false);\n });\n }\n // for animation, we don't want to animate entry or exit to a very far away pixel,\n // otherwise the row would move so fast, it would appear to disappear. so this method\n // moves the row closer to the viewport if it is far away, so the row slide in / out\n // at a speed the user can see.\n roundRowTopToBounds(rowTop) {\n const gridBodyCon = this.beans.ctrlsService.getGridBodyCtrl();\n const range = gridBodyCon.getScrollFeature().getVScrollPosition();\n const minPixel = this.applyPaginationOffset(range.top, true) - 100;\n const maxPixel = this.applyPaginationOffset(range.bottom, true) + 100;\n return Math.min(Math.max(minPixel, rowTop), maxPixel);\n }\n getFrameworkOverrides() {\n return this.beans.frameworkOverrides;\n }\n forEachGui(gui, callback) {\n if (gui) {\n callback(gui);\n }\n else {\n this.allRowGuis.forEach(callback);\n }\n }\n onRowHeightChanged(gui) {\n // check for exists first - if the user is resetting the row height, then\n // it will be null (or undefined) momentarily until the next time the flatten\n // stage is called where the row will then update again with a new height\n if (this.rowNode.rowHeight == null) {\n return;\n }\n const rowHeight = this.rowNode.rowHeight;\n const defaultRowHeight = this.beans.environment.getDefaultRowHeight();\n const isHeightFromFunc = this.gridOptionsService.isGetRowHeightFunction();\n const heightFromFunc = isHeightFromFunc ? this.gridOptionsService.getRowHeightForNode(this.rowNode).height : undefined;\n const lineHeight = heightFromFunc ? `${Math.min(defaultRowHeight, heightFromFunc) - 2}px` : undefined;\n this.forEachGui(gui, gui => {\n gui.element.style.height = `${rowHeight}px`;\n // If the row height is coming from a function, this means some rows can\n // be smaller than the theme had intended. so we set --ag-line-height on\n // the row, which is picked up by the theme CSS and is used in a calc\n // for the CSS line-height property, which makes sure the line-height is\n // not bigger than the row height, otherwise the row text would not fit.\n // We do not use rowNode.rowHeight here, as this could be the result of autoHeight,\n // and we found using the autoHeight result causes a loop, where changing the\n // line-height them impacts the cell height, resulting in a new autoHeight,\n // resulting in a new line-height and so on loop.\n // const heightFromFunc = this.gridOptionsService.getRowHeightForNode(this.rowNode).height;\n if (lineHeight) {\n gui.element.style.setProperty('--ag-line-height', lineHeight);\n }\n });\n }\n addEventListener(eventType, listener) {\n super.addEventListener(eventType, listener);\n }\n removeEventListener(eventType, listener) {\n super.removeEventListener(eventType, listener);\n }\n // note - this is NOT called by context, as we don't wire / unwire the CellComp for performance reasons.\n destroyFirstPass() {\n this.active = false;\n // why do we have this method? shouldn't everything below be added as a destroy func beside\n // the corresponding create logic?\n if (this.gridOptionsService.isAnimateRows()) {\n this.setupRemoveAnimation();\n }\n this.rowNode.setHovered(false);\n const event = this.createRowEvent(Events.EVENT_VIRTUAL_ROW_REMOVED);\n this.dispatchEvent(event);\n this.beans.eventService.dispatchEvent(event);\n super.destroy();\n }\n setupRemoveAnimation() {\n // we don't animate sticky rows\n if (this.isSticky()) {\n return;\n }\n const rowStillVisibleJustNotInViewport = this.rowNode.rowTop != null;\n if (rowStillVisibleJustNotInViewport) {\n // if the row is not rendered, but in viewport, it means it has moved,\n // so we animate the row out. if the new location is very far away,\n // the animation will be so fast the row will look like it's just disappeared,\n // so instead we animate to a position just outside the viewport.\n const rowTop = this.roundRowTopToBounds(this.rowNode.rowTop);\n this.setRowTop(rowTop);\n }\n else {\n this.allRowGuis.forEach(gui => gui.rowComp.addOrRemoveCssClass('ag-opacity-zero', true));\n }\n }\n destroySecondPass() {\n this.allRowGuis.length = 0;\n const destroyCellCtrls = (ctrls) => {\n ctrls.list.forEach(c => c.destroy());\n return { list: [], map: {} };\n };\n this.centerCellCtrls = destroyCellCtrls(this.centerCellCtrls);\n this.leftCellCtrls = destroyCellCtrls(this.leftCellCtrls);\n this.rightCellCtrls = destroyCellCtrls(this.rightCellCtrls);\n }\n setFocusedClasses(gui) {\n this.forEachGui(gui, gui => {\n gui.rowComp.addOrRemoveCssClass('ag-row-focus', this.rowFocused);\n gui.rowComp.addOrRemoveCssClass('ag-row-no-focus', !this.rowFocused);\n });\n }\n onCellFocused() {\n this.onCellFocusChanged();\n }\n onCellFocusCleared() {\n this.onCellFocusChanged();\n }\n onCellFocusChanged() {\n const rowFocused = this.beans.focusService.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned);\n if (rowFocused !== this.rowFocused) {\n this.rowFocused = rowFocused;\n this.setFocusedClasses();\n }\n // if we are editing, then moving the focus out of a row will stop editing\n if (!rowFocused && this.editingRow) {\n this.stopEditing(false);\n }\n }\n onPaginationChanged() {\n const currentPage = this.beans.paginationProxy.getCurrentPage();\n // it is possible this row is in the new page, but the page number has changed, which means\n // it needs to reposition itself relative to the new page\n if (this.paginationPage !== currentPage) {\n this.paginationPage = currentPage;\n this.onTopChanged();\n }\n this.refreshFirstAndLastRowStyles();\n }\n onTopChanged() {\n this.setRowTop(this.rowNode.rowTop);\n }\n onPaginationPixelOffsetChanged() {\n // the pixel offset is used when calculating rowTop to set on the row DIV\n this.onTopChanged();\n }\n // applies pagination offset, eg if on second page, and page height is 500px, then removes\n // 500px from the top position, so a row with rowTop 600px is displayed at location 100px.\n // reverse will take the offset away rather than add.\n applyPaginationOffset(topPx, reverse = false) {\n if (this.rowNode.isRowPinned() || this.rowNode.sticky) {\n return topPx;\n }\n const pixelOffset = this.beans.paginationProxy.getPixelOffset();\n const multiplier = reverse ? 1 : -1;\n return topPx + (pixelOffset * multiplier);\n }\n setRowTop(pixels) {\n // print layout uses normal flow layout for row positioning\n if (this.printLayout) {\n return;\n }\n // need to make sure rowTop is not null, as this can happen if the node was once\n // visible (ie parent group was expanded) but is now not visible\n if (exists(pixels)) {\n const afterPaginationPixels = this.applyPaginationOffset(pixels);\n const skipScaling = this.rowNode.isRowPinned() || this.rowNode.sticky;\n const afterScalingPixels = skipScaling ? afterPaginationPixels : this.beans.rowContainerHeightService.getRealPixelPosition(afterPaginationPixels);\n const topPx = `${afterScalingPixels}px`;\n this.setRowTopStyle(topPx);\n }\n }\n // the top needs to be set into the DOM element when the element is created, not updated afterwards.\n // otherwise the transition would not work, as it would be transitioning from zero (the unset value).\n // for example, suppose a row that is outside the viewport, then user does a filter to remove other rows\n // and this row now appears in the viewport, and the row moves up (ie it was under the viewport and not rendered,\n // but now is in the viewport) then a new RowComp is created, however it should have it's position initialised\n // to below the viewport, so the row will appear to animate up. if we didn't set the initial position at creation\n // time, the row would animate down (ie from position zero).\n getInitialRowTop(rowContainerType) {\n const suppressRowTransform = this.gridOptionsService.is('suppressRowTransform');\n return suppressRowTransform ? this.getInitialRowTopShared(rowContainerType) : undefined;\n }\n getInitialTransform(rowContainerType) {\n const suppressRowTransform = this.gridOptionsService.is('suppressRowTransform');\n return suppressRowTransform ? undefined : `translateY(${this.getInitialRowTopShared(rowContainerType)})`;\n }\n getInitialRowTopShared(rowContainerType) {\n // print layout uses normal flow layout for row positioning\n if (this.printLayout) {\n return '';\n }\n let rowTop;\n if (this.isSticky()) {\n rowTop = this.rowNode.stickyRowTop;\n }\n else {\n // if sliding in, we take the old row top. otherwise we just set the current row top.\n const pixels = this.slideInAnimation[rowContainerType] ? this.roundRowTopToBounds(this.rowNode.oldRowTop) : this.rowNode.rowTop;\n const afterPaginationPixels = this.applyPaginationOffset(pixels);\n // we don't apply scaling if row is pinned\n rowTop = this.rowNode.isRowPinned() ? afterPaginationPixels : this.beans.rowContainerHeightService.getRealPixelPosition(afterPaginationPixels);\n }\n return rowTop + 'px';\n }\n setRowTopStyle(topPx) {\n const suppressRowTransform = this.gridOptionsService.is('suppressRowTransform');\n this.allRowGuis.forEach(gui => suppressRowTransform ?\n gui.rowComp.setTop(topPx) :\n gui.rowComp.setTransform(`translateY(${topPx})`));\n }\n getRowNode() {\n return this.rowNode;\n }\n getCellCtrl(column) {\n // first up, check for cell directly linked to this column\n let res = null;\n this.getAllCellCtrls().forEach(cellCtrl => {\n if (cellCtrl.getColumn() == column) {\n res = cellCtrl;\n }\n });\n if (res != null) {\n return res;\n }\n // second up, if not found, then check for spanned cols.\n // we do this second (and not at the same time) as this is\n // more expensive, as spanning cols is a\n // infrequently used feature so we don't need to do this most\n // of the time\n this.getAllCellCtrls().forEach(cellCtrl => {\n if (cellCtrl.getColSpanningList().indexOf(column) >= 0) {\n res = cellCtrl;\n }\n });\n return res;\n }\n onRowIndexChanged() {\n // we only bother updating if the rowIndex is present. if it is not present, it means this row\n // is child of a group node, and the group node was closed, it's the only way to have no row index.\n // when this happens, row is about to be de-rendered, so we don't care, rowComp is about to die!\n if (this.rowNode.rowIndex != null) {\n this.onCellFocusChanged();\n this.updateRowIndexes();\n this.postProcessCss();\n }\n }\n getRowIndex() {\n return this.rowNode.getRowIndexString();\n }\n updateRowIndexes(gui) {\n const rowIndexStr = this.rowNode.getRowIndexString();\n const headerRowCount = this.beans.headerNavigationService.getHeaderRowCount() + this.beans.filterManager.getHeaderRowCount();\n const rowIsEven = this.rowNode.rowIndex % 2 === 0;\n const ariaRowIndex = headerRowCount + this.rowNode.rowIndex + 1;\n this.forEachGui(gui, c => {\n c.rowComp.setRowIndex(rowIndexStr);\n c.rowComp.addOrRemoveCssClass('ag-row-even', rowIsEven);\n c.rowComp.addOrRemoveCssClass('ag-row-odd', !rowIsEven);\n setAriaRowIndex(c.element, ariaRowIndex);\n });\n }\n // returns the pinned left container, either the normal one, or the embedded full with one if exists\n getPinnedLeftRowElement() {\n return this.leftGui ? this.leftGui.element : undefined;\n }\n // returns the pinned right container, either the normal one, or the embedded full with one if exists\n getPinnedRightRowElement() {\n return this.rightGui ? this.rightGui.element : undefined;\n }\n // returns the body container, either the normal one, or the embedded full with one if exists\n getBodyRowElement() {\n return this.centerGui ? this.centerGui.element : undefined;\n }\n // returns the full width container\n getFullWidthRowElement() {\n return this.fullWidthGui ? this.fullWidthGui.element : undefined;\n }\n}\nRowCtrl.DOM_DATA_KEY_ROW_CTRL = 'renderedRow';\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { getCtrlForEventTarget, isStopPropagationForAgGrid, isEventSupported } from \"../../utils/event.mjs\";\nimport { Autowired, Optional, PostConstruct } from \"../../context/context.mjs\";\nimport { RowCtrl } from \"../../rendering/row/rowCtrl.mjs\";\nimport { isIOSUserAgent } from \"../../utils/browser.mjs\";\nimport { TouchListener } from \"../../widgets/touchListener.mjs\";\nimport { isEventFromPrintableCharacter, isUserSuppressingKeyboardEvent } from \"../../utils/keyboard.mjs\";\nimport { Events } from \"../../events.mjs\";\nimport { KeyCode } from \"../../constants/keyCode.mjs\";\nimport { missingOrEmpty } from \"../../utils/generic.mjs\";\nimport { last } from \"../../utils/array.mjs\";\nimport { normaliseQwertyAzerty } from \"../../utils/keyboard.mjs\";\nimport { CellCtrl } from \"../../rendering/cell/cellCtrl.mjs\";\nexport class RowContainerEventsFeature extends BeanStub {\n constructor(element) {\n super();\n this.element = element;\n }\n postConstruct() {\n this.addKeyboardListeners();\n this.addMouseListeners();\n this.mockContextMenuForIPad();\n }\n addKeyboardListeners() {\n const eventName = 'keydown';\n const listener = this.processKeyboardEvent.bind(this, eventName);\n this.addManagedListener(this.element, eventName, listener);\n }\n addMouseListeners() {\n const mouseDownEvent = isEventSupported('touchstart') ? 'touchstart' : 'mousedown';\n const eventNames = ['dblclick', 'contextmenu', 'mouseover', 'mouseout', 'click', mouseDownEvent];\n eventNames.forEach(eventName => {\n const listener = this.processMouseEvent.bind(this, eventName);\n this.addManagedListener(this.element, eventName, listener);\n });\n }\n processMouseEvent(eventName, mouseEvent) {\n if (!this.mouseEventService.isEventFromThisGrid(mouseEvent) ||\n isStopPropagationForAgGrid(mouseEvent)) {\n return;\n }\n const rowComp = this.getRowForEvent(mouseEvent);\n const cellCtrl = this.mouseEventService.getRenderedCellForEvent(mouseEvent);\n if (eventName === \"contextmenu\") {\n this.handleContextMenuMouseEvent(mouseEvent, null, rowComp, cellCtrl);\n }\n else {\n if (cellCtrl) {\n cellCtrl.onMouseEvent(eventName, mouseEvent);\n }\n if (rowComp) {\n rowComp.onMouseEvent(eventName, mouseEvent);\n }\n }\n }\n mockContextMenuForIPad() {\n // we do NOT want this when not in iPad, otherwise we will be doing\n if (!isIOSUserAgent()) {\n return;\n }\n const touchListener = new TouchListener(this.element);\n const longTapListener = (event) => {\n const rowComp = this.getRowForEvent(event.touchEvent);\n const cellComp = this.mouseEventService.getRenderedCellForEvent(event.touchEvent);\n this.handleContextMenuMouseEvent(null, event.touchEvent, rowComp, cellComp);\n };\n this.addManagedListener(touchListener, TouchListener.EVENT_LONG_TAP, longTapListener);\n this.addDestroyFunc(() => touchListener.destroy());\n }\n getRowForEvent(event) {\n let sourceElement = event.target;\n while (sourceElement) {\n const rowCon = this.gridOptionsService.getDomData(sourceElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL);\n if (rowCon) {\n return rowCon;\n }\n sourceElement = sourceElement.parentElement;\n }\n return null;\n }\n handleContextMenuMouseEvent(mouseEvent, touchEvent, rowComp, cellCtrl) {\n const rowNode = rowComp ? rowComp.getRowNode() : null;\n const column = cellCtrl ? cellCtrl.getColumn() : null;\n let value = null;\n if (column) {\n const event = mouseEvent ? mouseEvent : touchEvent;\n cellCtrl.dispatchCellContextMenuEvent(event);\n value = this.valueService.getValue(column, rowNode);\n }\n // if user clicked on a cell, anchor to that cell, otherwise anchor to the grid panel\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n const anchorToElement = cellCtrl ? cellCtrl.getGui() : gridBodyCon.getGridBodyElement();\n if (this.contextMenuFactory) {\n this.contextMenuFactory.onContextMenu(mouseEvent, touchEvent, rowNode, column, value, anchorToElement);\n }\n }\n getControlsForEventTarget(target) {\n return {\n cellCtrl: getCtrlForEventTarget(this.gridOptionsService, target, CellCtrl.DOM_DATA_KEY_CELL_CTRL),\n rowCtrl: getCtrlForEventTarget(this.gridOptionsService, target, RowCtrl.DOM_DATA_KEY_ROW_CTRL)\n };\n }\n processKeyboardEvent(eventName, keyboardEvent) {\n const { cellCtrl, rowCtrl } = this.getControlsForEventTarget(keyboardEvent.target);\n if (keyboardEvent.defaultPrevented) {\n return;\n }\n if (cellCtrl) {\n this.processCellKeyboardEvent(cellCtrl, eventName, keyboardEvent);\n }\n else if (rowCtrl && rowCtrl.isFullWidth()) {\n this.processFullWidthRowKeyboardEvent(rowCtrl, eventName, keyboardEvent);\n }\n }\n processCellKeyboardEvent(cellCtrl, eventName, keyboardEvent) {\n const rowNode = cellCtrl.getRowNode();\n const column = cellCtrl.getColumn();\n const editing = cellCtrl.isEditing();\n const gridProcessingAllowed = !isUserSuppressingKeyboardEvent(this.gridOptionsService, keyboardEvent, rowNode, column, editing);\n if (gridProcessingAllowed) {\n if (eventName === 'keydown') {\n // first see if it's a scroll key, page up / down, home / end etc\n const wasScrollKey = !editing && this.navigationService.handlePageScrollingKey(keyboardEvent);\n // if not a scroll key, then we pass onto cell\n if (!wasScrollKey) {\n cellCtrl.onKeyDown(keyboardEvent);\n }\n // perform clipboard and undo / redo operations\n this.doGridOperations(keyboardEvent, cellCtrl.isEditing());\n if (isEventFromPrintableCharacter(keyboardEvent)) {\n cellCtrl.processCharacter(keyboardEvent);\n }\n }\n }\n if (eventName === 'keydown') {\n const cellKeyDownEvent = cellCtrl.createEvent(keyboardEvent, Events.EVENT_CELL_KEY_DOWN);\n this.eventService.dispatchEvent(cellKeyDownEvent);\n }\n }\n processFullWidthRowKeyboardEvent(rowComp, eventName, keyboardEvent) {\n const rowNode = rowComp.getRowNode();\n const focusedCell = this.focusService.getFocusedCell();\n const column = (focusedCell && focusedCell.column);\n const gridProcessingAllowed = !isUserSuppressingKeyboardEvent(this.gridOptionsService, keyboardEvent, rowNode, column, false);\n if (gridProcessingAllowed) {\n const key = keyboardEvent.key;\n if (eventName === 'keydown') {\n switch (key) {\n case KeyCode.PAGE_HOME:\n case KeyCode.PAGE_END:\n case KeyCode.PAGE_UP:\n case KeyCode.PAGE_DOWN:\n this.navigationService.handlePageScrollingKey(keyboardEvent, true);\n break;\n case KeyCode.UP:\n case KeyCode.DOWN:\n rowComp.onKeyboardNavigate(keyboardEvent);\n break;\n case KeyCode.TAB:\n rowComp.onTabKeyDown(keyboardEvent);\n break;\n default:\n }\n }\n }\n if (eventName === 'keydown') {\n const cellKeyDownEvent = rowComp.createRowEvent(Events.EVENT_CELL_KEY_DOWN, keyboardEvent);\n this.eventService.dispatchEvent(cellKeyDownEvent);\n }\n }\n doGridOperations(keyboardEvent, editing) {\n // check if ctrl or meta key pressed\n if (!keyboardEvent.ctrlKey && !keyboardEvent.metaKey) {\n return;\n }\n // if the cell the event came from is editing, then we do not\n // want to do the default shortcut keys, otherwise the editor\n // (eg a text field) would not be able to do the normal cut/copy/paste\n if (editing) {\n return;\n }\n // for copy / paste, we don't want to execute when the event\n // was from a child grid (happens in master detail)\n if (!this.mouseEventService.isEventFromThisGrid(keyboardEvent)) {\n return;\n }\n const keyCode = normaliseQwertyAzerty(keyboardEvent);\n if (keyCode === KeyCode.A) {\n return this.onCtrlAndA(keyboardEvent);\n }\n if (keyCode === KeyCode.C) {\n return this.onCtrlAndC(keyboardEvent);\n }\n if (keyCode === KeyCode.D) {\n return this.onCtrlAndD(keyboardEvent);\n }\n if (keyCode === KeyCode.V) {\n return this.onCtrlAndV(keyboardEvent);\n }\n if (keyCode === KeyCode.X) {\n return this.onCtrlAndX(keyboardEvent);\n }\n if (keyCode === KeyCode.Y) {\n return this.onCtrlAndY();\n }\n if (keyCode === KeyCode.Z) {\n return this.onCtrlAndZ(keyboardEvent);\n }\n }\n onCtrlAndA(event) {\n const { pinnedRowModel, paginationProxy, rangeService } = this;\n if (rangeService && paginationProxy.isRowsToRender()) {\n const [isEmptyPinnedTop, isEmptyPinnedBottom] = [\n pinnedRowModel.isEmpty('top'),\n pinnedRowModel.isEmpty('bottom')\n ];\n const floatingStart = isEmptyPinnedTop ? null : 'top';\n let floatingEnd;\n let rowEnd;\n if (isEmptyPinnedBottom) {\n floatingEnd = null;\n rowEnd = this.paginationProxy.getRowCount() - 1;\n }\n else {\n floatingEnd = 'bottom';\n rowEnd = pinnedRowModel.getPinnedBottomRowData().length - 1;\n }\n const allDisplayedColumns = this.columnModel.getAllDisplayedColumns();\n if (missingOrEmpty(allDisplayedColumns)) {\n return;\n }\n rangeService.setCellRange({\n rowStartIndex: 0,\n rowStartPinned: floatingStart,\n rowEndIndex: rowEnd,\n rowEndPinned: floatingEnd,\n columnStart: allDisplayedColumns[0],\n columnEnd: last(allDisplayedColumns)\n });\n }\n event.preventDefault();\n }\n onCtrlAndC(event) {\n if (!this.clipboardService || this.gridOptionsService.is('enableCellTextSelection')) {\n return;\n }\n const { cellCtrl, rowCtrl } = this.getControlsForEventTarget(event.target);\n if ((cellCtrl === null || cellCtrl === void 0 ? void 0 : cellCtrl.isEditing()) || (rowCtrl === null || rowCtrl === void 0 ? void 0 : rowCtrl.isEditing())) {\n return;\n }\n event.preventDefault();\n this.clipboardService.copyToClipboard();\n }\n onCtrlAndX(event) {\n if (!this.clipboardService ||\n this.gridOptionsService.is('enableCellTextSelection') ||\n this.gridOptionsService.is('suppressCutToClipboard')) {\n return;\n }\n const { cellCtrl, rowCtrl } = this.getControlsForEventTarget(event.target);\n if ((cellCtrl === null || cellCtrl === void 0 ? void 0 : cellCtrl.isEditing()) || (rowCtrl === null || rowCtrl === void 0 ? void 0 : rowCtrl.isEditing())) {\n return;\n }\n event.preventDefault();\n this.clipboardService.cutToClipboard(undefined, 'ui');\n }\n onCtrlAndV(event) {\n const { cellCtrl, rowCtrl } = this.getControlsForEventTarget(event.target);\n if ((cellCtrl === null || cellCtrl === void 0 ? void 0 : cellCtrl.isEditing()) || (rowCtrl === null || rowCtrl === void 0 ? void 0 : rowCtrl.isEditing())) {\n return;\n }\n if (this.clipboardService && !this.gridOptionsService.is('suppressClipboardPaste')) {\n this.clipboardService.pasteFromClipboard();\n }\n }\n onCtrlAndD(event) {\n if (this.clipboardService && !this.gridOptionsService.is('suppressClipboardPaste')) {\n this.clipboardService.copyRangeDown();\n }\n event.preventDefault();\n }\n onCtrlAndZ(event) {\n if (!this.gridOptionsService.is('undoRedoCellEditing')) {\n return;\n }\n event.preventDefault();\n if (event.shiftKey) {\n this.undoRedoService.redo('ui');\n }\n else {\n this.undoRedoService.undo('ui');\n }\n }\n onCtrlAndY() {\n this.undoRedoService.redo('ui');\n }\n}\n__decorate([\n Autowired('mouseEventService')\n], RowContainerEventsFeature.prototype, \"mouseEventService\", void 0);\n__decorate([\n Autowired('valueService')\n], RowContainerEventsFeature.prototype, \"valueService\", void 0);\n__decorate([\n Optional('contextMenuFactory')\n], RowContainerEventsFeature.prototype, \"contextMenuFactory\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], RowContainerEventsFeature.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('navigationService')\n], RowContainerEventsFeature.prototype, \"navigationService\", void 0);\n__decorate([\n Autowired('focusService')\n], RowContainerEventsFeature.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('undoRedoService')\n], RowContainerEventsFeature.prototype, \"undoRedoService\", void 0);\n__decorate([\n Autowired('columnModel')\n], RowContainerEventsFeature.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('paginationProxy')\n], RowContainerEventsFeature.prototype, \"paginationProxy\", void 0);\n__decorate([\n Autowired('pinnedRowModel')\n], RowContainerEventsFeature.prototype, \"pinnedRowModel\", void 0);\n__decorate([\n Optional('rangeService')\n], RowContainerEventsFeature.prototype, \"rangeService\", void 0);\n__decorate([\n Optional('clipboardService')\n], RowContainerEventsFeature.prototype, \"clipboardService\", void 0);\n__decorate([\n PostConstruct\n], RowContainerEventsFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { Events } from \"../events.mjs\";\nimport { getInnerHeight } from \"../utils/dom.mjs\";\n// listens to changes in the center viewport size, for column and row virtualisation,\n// and adjusts grid as necessary. there are two viewports, one for horizontal and one for\n// vertical scrolling.\nexport class ViewportSizeFeature extends BeanStub {\n constructor(centerContainerCtrl) {\n super();\n this.centerContainerCtrl = centerContainerCtrl;\n }\n postConstruct() {\n this.ctrlsService.whenReady(() => {\n this.gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();\n this.listenForResize();\n });\n this.addManagedListener(this.eventService, Events.EVENT_SCROLLBAR_WIDTH_CHANGED, this.onScrollbarWidthChanged.bind(this));\n }\n listenForResize() {\n const listener = () => this.onCenterViewportResized();\n // centerContainer gets horizontal resizes\n this.centerContainerCtrl.registerViewportResizeListener(listener);\n // eBodyViewport gets vertical resizes\n this.gridBodyCtrl.registerBodyViewportResizeListener(listener);\n }\n onScrollbarWidthChanged() {\n this.checkViewportAndScrolls();\n }\n onCenterViewportResized() {\n if (this.centerContainerCtrl.isViewportVisible()) {\n this.checkViewportAndScrolls();\n const newWidth = this.centerContainerCtrl.getCenterWidth();\n if (newWidth !== this.centerWidth) {\n this.centerWidth = newWidth;\n this.columnModel.refreshFlexedColumns({ viewportWidth: this.centerWidth, updateBodyWidths: true, fireResizedEvent: true });\n }\n }\n else {\n this.bodyHeight = 0;\n }\n }\n // gets called every time the viewport size changes. we use this to check visibility of scrollbars\n // in the grid panel, and also to check size and position of viewport for row and column virtualisation.\n checkViewportAndScrolls() {\n // results in updating anything that depends on scroll showing\n this.updateScrollVisibleService();\n // fires event if height changes, used by PaginationService, HeightScalerService, RowRenderer\n this.checkBodyHeight();\n // check for virtual columns for ColumnController\n this.onHorizontalViewportChanged();\n this.gridBodyCtrl.getScrollFeature().checkScrollLeft();\n }\n getBodyHeight() {\n return this.bodyHeight;\n }\n checkBodyHeight() {\n const eBodyViewport = this.gridBodyCtrl.getBodyViewportElement();\n const bodyHeight = getInnerHeight(eBodyViewport);\n if (this.bodyHeight !== bodyHeight) {\n this.bodyHeight = bodyHeight;\n const event = {\n type: Events.EVENT_BODY_HEIGHT_CHANGED\n };\n this.eventService.dispatchEvent(event);\n }\n }\n updateScrollVisibleService() {\n // because of column animation (which takes 200ms), we have to do this twice.\n // eg if user removes cols anywhere except at the RHS, then the cols on the RHS\n // will animate to the left to fill the gap. this animation means just after\n // the cols are removed, the remaining cols are still in the original location\n // at the start of the animation, so pre animation the H scrollbar is still needed,\n // but post animation it is not.\n this.updateScrollVisibleServiceImpl();\n setTimeout(this.updateScrollVisibleServiceImpl.bind(this), 500);\n }\n updateScrollVisibleServiceImpl() {\n const params = {\n horizontalScrollShowing: this.isHorizontalScrollShowing(),\n verticalScrollShowing: this.gridBodyCtrl.isVerticalScrollShowing()\n };\n this.scrollVisibleService.setScrollsVisible(params);\n }\n isHorizontalScrollShowing() {\n return this.centerContainerCtrl.isHorizontalScrollShowing();\n }\n // this gets called whenever a change in the viewport, so we can inform column controller it has to work\n // out the virtual columns again. gets called from following locations:\n // + ensureColVisible, scroll, init, layoutChanged, displayedColumnsChanged\n onHorizontalViewportChanged() {\n const scrollWidth = this.centerContainerCtrl.getCenterWidth();\n const scrollPosition = this.centerContainerCtrl.getViewportScrollLeft();\n this.columnModel.setViewportPosition(scrollWidth, scrollPosition);\n }\n}\n__decorate([\n Autowired('ctrlsService')\n], ViewportSizeFeature.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('columnModel')\n], ViewportSizeFeature.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('scrollVisibleService')\n], ViewportSizeFeature.prototype, \"scrollVisibleService\", void 0);\n__decorate([\n PostConstruct\n], ViewportSizeFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired, PostConstruct } from \"../../context/context.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nimport { setDisplayed, setFixedWidth } from \"../../utils/dom.mjs\";\nexport class SetPinnedLeftWidthFeature extends BeanStub {\n constructor(element) {\n super();\n this.element = element;\n }\n postConstruct() {\n this.addManagedListener(this.eventService, Events.EVENT_LEFT_PINNED_WIDTH_CHANGED, this.onPinnedLeftWidthChanged.bind(this));\n }\n onPinnedLeftWidthChanged() {\n const leftWidth = this.pinnedWidthService.getPinnedLeftWidth();\n const displayed = leftWidth > 0;\n setDisplayed(this.element, displayed);\n setFixedWidth(this.element, leftWidth);\n }\n getWidth() {\n return this.pinnedWidthService.getPinnedLeftWidth();\n }\n}\n__decorate([\n Autowired('pinnedWidthService')\n], SetPinnedLeftWidthFeature.prototype, \"pinnedWidthService\", void 0);\n__decorate([\n PostConstruct\n], SetPinnedLeftWidthFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from \"../../context/context.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nimport { setDisplayed, setFixedWidth } from \"../../utils/dom.mjs\";\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nexport class SetPinnedRightWidthFeature extends BeanStub {\n constructor(element) {\n super();\n this.element = element;\n }\n postConstruct() {\n this.addManagedListener(this.eventService, Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED, this.onPinnedRightWidthChanged.bind(this));\n }\n onPinnedRightWidthChanged() {\n const rightWidth = this.pinnedWidthService.getPinnedRightWidth();\n const displayed = rightWidth > 0;\n setDisplayed(this.element, displayed);\n setFixedWidth(this.element, rightWidth);\n }\n getWidth() {\n return this.pinnedWidthService.getPinnedRightWidth();\n }\n}\n__decorate([\n Autowired('pinnedWidthService')\n], SetPinnedRightWidthFeature.prototype, \"pinnedWidthService\", void 0);\n__decorate([\n PostConstruct\n], SetPinnedRightWidthFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired, PostConstruct } from \"../../context/context.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nexport class SetHeightFeature extends BeanStub {\n constructor(eContainer, eWrapper) {\n super();\n this.eContainer = eContainer;\n this.eWrapper = eWrapper;\n }\n postConstruct() {\n this.addManagedListener(this.eventService, Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED, this.onHeightChanged.bind(this));\n }\n onHeightChanged() {\n const height = this.maxDivHeightScaler.getUiContainerHeight();\n const heightString = height != null ? `${height}px` : ``;\n this.eContainer.style.height = heightString;\n if (this.eWrapper) {\n this.eWrapper.style.height = heightString;\n }\n }\n}\n__decorate([\n Autowired(\"rowContainerHeightService\")\n], SetHeightFeature.prototype, \"maxDivHeightScaler\", void 0);\n__decorate([\n PostConstruct\n], SetHeightFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { missing } from \"../../utils/generic.mjs\";\nimport { Autowired, Optional, PostConstruct } from \"../../context/context.mjs\";\nexport class DragListenerFeature extends BeanStub {\n constructor(eContainer) {\n super();\n this.eContainer = eContainer;\n }\n postConstruct() {\n if (!this.gridOptionsService.isEnableRangeSelection() || // no range selection if no property\n missing(this.rangeService) // no range selection if not enterprise version\n ) {\n return;\n }\n const params = {\n eElement: this.eContainer,\n onDragStart: this.rangeService.onDragStart.bind(this.rangeService),\n onDragStop: this.rangeService.onDragStop.bind(this.rangeService),\n onDragging: this.rangeService.onDragging.bind(this.rangeService)\n };\n this.dragService.addDragSource(params);\n this.addDestroyFunc(() => this.dragService.removeDragSource(params));\n }\n}\n__decorate([\n Optional('rangeService')\n], DragListenerFeature.prototype, \"rangeService\", void 0);\n__decorate([\n Autowired('dragService')\n], DragListenerFeature.prototype, \"dragService\", void 0);\n__decorate([\n PostConstruct\n], DragListenerFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nexport class CenterWidthFeature extends BeanStub {\n constructor(callback, addSpacer = false) {\n super();\n this.callback = callback;\n this.addSpacer = addSpacer;\n }\n postConstruct() {\n const listener = this.setWidth.bind(this);\n this.addManagedPropertyListener('domLayout', listener);\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, listener);\n this.addManagedListener(this.eventService, Events.EVENT_LEFT_PINNED_WIDTH_CHANGED, listener);\n if (this.addSpacer) {\n this.addManagedListener(this.eventService, Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED, listener);\n this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, listener);\n this.addManagedListener(this.eventService, Events.EVENT_SCROLLBAR_WIDTH_CHANGED, listener);\n }\n this.setWidth();\n }\n setWidth() {\n const { columnModel } = this;\n const printLayout = this.gridOptionsService.isDomLayout('print');\n const centerWidth = columnModel.getBodyContainerWidth();\n const leftWidth = columnModel.getDisplayedColumnsLeftWidth();\n const rightWidth = columnModel.getDisplayedColumnsRightWidth();\n let totalWidth;\n if (printLayout) {\n totalWidth = centerWidth + leftWidth + rightWidth;\n }\n else {\n totalWidth = centerWidth;\n if (this.addSpacer) {\n const relevantWidth = this.gridOptionsService.is('enableRtl') ? leftWidth : rightWidth;\n if (relevantWidth === 0 && this.scrollVisibleService.isVerticalScrollShowing()) {\n totalWidth += this.gridOptionsService.getScrollbarWidth();\n }\n }\n }\n this.callback(totalWidth);\n }\n}\n__decorate([\n Autowired('columnModel')\n], CenterWidthFeature.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('scrollVisibleService')\n], CenterWidthFeature.prototype, \"scrollVisibleService\", void 0);\n__decorate([\n PostConstruct\n], CenterWidthFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired, PostConstruct } from \"../../context/context.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nimport { RowContainerEventsFeature } from \"./rowContainerEventsFeature.mjs\";\nimport { getInnerWidth, getScrollLeft, isHorizontalScrollShowing, isVisible, setScrollLeft } from \"../../utils/dom.mjs\";\nimport { ViewportSizeFeature } from \"../viewportSizeFeature.mjs\";\nimport { convertToMap } from \"../../utils/map.mjs\";\nimport { SetPinnedLeftWidthFeature } from \"./setPinnedLeftWidthFeature.mjs\";\nimport { SetPinnedRightWidthFeature } from \"./setPinnedRightWidthFeature.mjs\";\nimport { SetHeightFeature } from \"./setHeightFeature.mjs\";\nimport { DragListenerFeature } from \"./dragListenerFeature.mjs\";\nimport { CenterWidthFeature } from \"../centerWidthFeature.mjs\";\nimport { isInvisibleScrollbar } from \"../../utils/browser.mjs\";\nexport var RowContainerName;\n(function (RowContainerName) {\n RowContainerName[\"LEFT\"] = \"left\";\n RowContainerName[\"RIGHT\"] = \"right\";\n RowContainerName[\"CENTER\"] = \"center\";\n RowContainerName[\"FULL_WIDTH\"] = \"fullWidth\";\n RowContainerName[\"TOP_LEFT\"] = \"topLeft\";\n RowContainerName[\"TOP_RIGHT\"] = \"topRight\";\n RowContainerName[\"TOP_CENTER\"] = \"topCenter\";\n RowContainerName[\"TOP_FULL_WIDTH\"] = \"topFullWidth\";\n RowContainerName[\"STICKY_TOP_LEFT\"] = \"stickyTopLeft\";\n RowContainerName[\"STICKY_TOP_RIGHT\"] = \"stickyTopRight\";\n RowContainerName[\"STICKY_TOP_CENTER\"] = \"stickyTopCenter\";\n RowContainerName[\"STICKY_TOP_FULL_WIDTH\"] = \"stickyTopFullWidth\";\n RowContainerName[\"BOTTOM_LEFT\"] = \"bottomLeft\";\n RowContainerName[\"BOTTOM_RIGHT\"] = \"bottomRight\";\n RowContainerName[\"BOTTOM_CENTER\"] = \"bottomCenter\";\n RowContainerName[\"BOTTOM_FULL_WIDTH\"] = \"bottomFullWidth\";\n})(RowContainerName || (RowContainerName = {}));\nexport var RowContainerType;\n(function (RowContainerType) {\n RowContainerType[\"LEFT\"] = \"left\";\n RowContainerType[\"RIGHT\"] = \"right\";\n RowContainerType[\"CENTER\"] = \"center\";\n RowContainerType[\"FULL_WIDTH\"] = \"fullWidth\";\n})(RowContainerType || (RowContainerType = {}));\nexport function getRowContainerTypeForName(name) {\n switch (name) {\n case RowContainerName.CENTER:\n case RowContainerName.TOP_CENTER:\n case RowContainerName.STICKY_TOP_CENTER:\n case RowContainerName.BOTTOM_CENTER:\n return RowContainerType.CENTER;\n case RowContainerName.LEFT:\n case RowContainerName.TOP_LEFT:\n case RowContainerName.STICKY_TOP_LEFT:\n case RowContainerName.BOTTOM_LEFT:\n return RowContainerType.LEFT;\n case RowContainerName.RIGHT:\n case RowContainerName.TOP_RIGHT:\n case RowContainerName.STICKY_TOP_RIGHT:\n case RowContainerName.BOTTOM_RIGHT:\n return RowContainerType.RIGHT;\n case RowContainerName.FULL_WIDTH:\n case RowContainerName.TOP_FULL_WIDTH:\n case RowContainerName.STICKY_TOP_FULL_WIDTH:\n case RowContainerName.BOTTOM_FULL_WIDTH:\n return RowContainerType.FULL_WIDTH;\n default:\n throw Error('Invalid Row Container Type');\n }\n}\nconst ContainerCssClasses = convertToMap([\n [RowContainerName.CENTER, 'ag-center-cols-container'],\n [RowContainerName.LEFT, 'ag-pinned-left-cols-container'],\n [RowContainerName.RIGHT, 'ag-pinned-right-cols-container'],\n [RowContainerName.FULL_WIDTH, 'ag-full-width-container'],\n [RowContainerName.TOP_CENTER, 'ag-floating-top-container'],\n [RowContainerName.TOP_LEFT, 'ag-pinned-left-floating-top'],\n [RowContainerName.TOP_RIGHT, 'ag-pinned-right-floating-top'],\n [RowContainerName.TOP_FULL_WIDTH, 'ag-floating-top-full-width-container'],\n [RowContainerName.STICKY_TOP_CENTER, 'ag-sticky-top-container'],\n [RowContainerName.STICKY_TOP_LEFT, 'ag-pinned-left-sticky-top'],\n [RowContainerName.STICKY_TOP_RIGHT, 'ag-pinned-right-sticky-top'],\n [RowContainerName.STICKY_TOP_FULL_WIDTH, 'ag-sticky-top-full-width-container'],\n [RowContainerName.BOTTOM_CENTER, 'ag-floating-bottom-container'],\n [RowContainerName.BOTTOM_LEFT, 'ag-pinned-left-floating-bottom'],\n [RowContainerName.BOTTOM_RIGHT, 'ag-pinned-right-floating-bottom'],\n [RowContainerName.BOTTOM_FULL_WIDTH, 'ag-floating-bottom-full-width-container'],\n]);\nconst ViewportCssClasses = convertToMap([\n [RowContainerName.CENTER, 'ag-center-cols-viewport'],\n [RowContainerName.TOP_CENTER, 'ag-floating-top-viewport'],\n [RowContainerName.STICKY_TOP_CENTER, 'ag-sticky-top-viewport'],\n [RowContainerName.BOTTOM_CENTER, 'ag-floating-bottom-viewport'],\n]);\nconst WrapperCssClasses = convertToMap([\n [RowContainerName.CENTER, 'ag-center-cols-clipper'],\n]);\nexport class RowContainerCtrl extends BeanStub {\n constructor(name) {\n super();\n this.visible = true;\n // Maintaining a constant reference enables optimization in React.\n this.EMPTY_CTRLS = [];\n this.name = name;\n this.isFullWithContainer =\n this.name === RowContainerName.TOP_FULL_WIDTH\n || this.name === RowContainerName.STICKY_TOP_FULL_WIDTH\n || this.name === RowContainerName.BOTTOM_FULL_WIDTH\n || this.name === RowContainerName.FULL_WIDTH;\n }\n static getRowContainerCssClasses(name) {\n const containerClass = ContainerCssClasses.get(name);\n const viewportClass = ViewportCssClasses.get(name);\n const wrapperClass = WrapperCssClasses.get(name);\n return { container: containerClass, viewport: viewportClass, wrapper: wrapperClass };\n }\n static getPinned(name) {\n switch (name) {\n case RowContainerName.BOTTOM_LEFT:\n case RowContainerName.TOP_LEFT:\n case RowContainerName.STICKY_TOP_LEFT:\n case RowContainerName.LEFT:\n return 'left';\n case RowContainerName.BOTTOM_RIGHT:\n case RowContainerName.TOP_RIGHT:\n case RowContainerName.STICKY_TOP_RIGHT:\n case RowContainerName.RIGHT:\n return 'right';\n default:\n return null;\n }\n }\n postConstruct() {\n this.enableRtl = this.gridOptionsService.is('enableRtl');\n this.embedFullWidthRows = this.gridOptionsService.is('embedFullWidthRows');\n this.forContainers([RowContainerName.CENTER], () => this.viewportSizeFeature = this.createManagedBean(new ViewportSizeFeature(this)));\n }\n registerWithCtrlsService() {\n switch (this.name) {\n case RowContainerName.CENTER:\n this.ctrlsService.registerCenterRowContainerCtrl(this);\n break;\n case RowContainerName.LEFT:\n this.ctrlsService.registerLeftRowContainerCtrl(this);\n break;\n case RowContainerName.RIGHT:\n this.ctrlsService.registerRightRowContainerCtrl(this);\n break;\n case RowContainerName.TOP_CENTER:\n this.ctrlsService.registerTopCenterRowContainerCtrl(this);\n break;\n case RowContainerName.TOP_LEFT:\n this.ctrlsService.registerTopLeftRowContainerCon(this);\n break;\n case RowContainerName.TOP_RIGHT:\n this.ctrlsService.registerTopRightRowContainerCtrl(this);\n break;\n case RowContainerName.STICKY_TOP_CENTER:\n this.ctrlsService.registerStickyTopCenterRowContainerCtrl(this);\n break;\n case RowContainerName.STICKY_TOP_LEFT:\n this.ctrlsService.registerStickyTopLeftRowContainerCon(this);\n break;\n case RowContainerName.STICKY_TOP_RIGHT:\n this.ctrlsService.registerStickyTopRightRowContainerCtrl(this);\n break;\n case RowContainerName.BOTTOM_CENTER:\n this.ctrlsService.registerBottomCenterRowContainerCtrl(this);\n break;\n case RowContainerName.BOTTOM_LEFT:\n this.ctrlsService.registerBottomLeftRowContainerCtrl(this);\n break;\n case RowContainerName.BOTTOM_RIGHT:\n this.ctrlsService.registerBottomRightRowContainerCtrl(this);\n break;\n }\n }\n forContainers(names, callback) {\n if (names.indexOf(this.name) >= 0) {\n callback();\n }\n }\n getContainerElement() {\n return this.eContainer;\n }\n getViewportSizeFeature() {\n return this.viewportSizeFeature;\n }\n setComp(view, eContainer, eViewport, eWrapper) {\n this.comp = view;\n this.eContainer = eContainer;\n this.eViewport = eViewport;\n this.eWrapper = eWrapper;\n this.createManagedBean(new RowContainerEventsFeature(this.eContainer));\n this.addPreventScrollWhileDragging();\n this.listenOnDomOrder();\n this.stopHScrollOnPinnedRows();\n const allTopNoFW = [RowContainerName.TOP_CENTER, RowContainerName.TOP_LEFT, RowContainerName.TOP_RIGHT];\n const allStickyTopNoFW = [RowContainerName.STICKY_TOP_CENTER, RowContainerName.STICKY_TOP_LEFT, RowContainerName.STICKY_TOP_RIGHT];\n const allBottomNoFW = [RowContainerName.BOTTOM_CENTER, RowContainerName.BOTTOM_LEFT, RowContainerName.BOTTOM_RIGHT];\n const allMiddleNoFW = [RowContainerName.CENTER, RowContainerName.LEFT, RowContainerName.RIGHT];\n const allNoFW = [...allTopNoFW, ...allBottomNoFW, ...allMiddleNoFW, ...allStickyTopNoFW];\n const allMiddle = [RowContainerName.CENTER, RowContainerName.LEFT, RowContainerName.RIGHT, RowContainerName.FULL_WIDTH];\n const allCenter = [RowContainerName.CENTER, RowContainerName.TOP_CENTER, RowContainerName.STICKY_TOP_CENTER, RowContainerName.BOTTOM_CENTER];\n const allLeft = [RowContainerName.LEFT, RowContainerName.BOTTOM_LEFT, RowContainerName.TOP_LEFT, RowContainerName.STICKY_TOP_LEFT];\n const allRight = [RowContainerName.RIGHT, RowContainerName.BOTTOM_RIGHT, RowContainerName.TOP_RIGHT, RowContainerName.STICKY_TOP_RIGHT];\n this.forContainers(allLeft, () => {\n this.pinnedWidthFeature = this.createManagedBean(new SetPinnedLeftWidthFeature(this.eContainer));\n this.addManagedListener(this.eventService, Events.EVENT_LEFT_PINNED_WIDTH_CHANGED, () => this.onPinnedWidthChanged());\n });\n this.forContainers(allRight, () => {\n this.pinnedWidthFeature = this.createManagedBean(new SetPinnedRightWidthFeature(this.eContainer));\n this.addManagedListener(this.eventService, Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED, () => this.onPinnedWidthChanged());\n });\n this.forContainers(allMiddle, () => this.createManagedBean(new SetHeightFeature(this.eContainer, this.eWrapper)));\n this.forContainers(allNoFW, () => this.createManagedBean(new DragListenerFeature(this.eContainer)));\n this.forContainers(allCenter, () => this.createManagedBean(new CenterWidthFeature(width => this.comp.setContainerWidth(`${width}px`))));\n if (isInvisibleScrollbar()) {\n this.forContainers([RowContainerName.CENTER], () => {\n const pinnedWidthChangedEvent = this.enableRtl ? Events.EVENT_LEFT_PINNED_WIDTH_CHANGED : Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED;\n this.addManagedListener(this.eventService, pinnedWidthChangedEvent, () => this.refreshPaddingForFakeScrollbar());\n });\n this.refreshPaddingForFakeScrollbar();\n }\n this.addListeners();\n this.registerWithCtrlsService();\n }\n refreshPaddingForFakeScrollbar() {\n const { enableRtl, columnModel, name, eWrapper, eContainer } = this;\n const sideToCheck = enableRtl ? RowContainerName.LEFT : RowContainerName.RIGHT;\n this.forContainers([RowContainerName.CENTER, sideToCheck], () => {\n const pinnedWidth = columnModel.getContainerWidth(sideToCheck);\n const marginSide = enableRtl ? 'marginLeft' : 'marginRight';\n if (name === RowContainerName.CENTER) {\n eWrapper.style[marginSide] = pinnedWidth ? '0px' : '16px';\n }\n else {\n eContainer.style[marginSide] = pinnedWidth ? '16px' : '0px';\n }\n });\n }\n addListeners() {\n this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, () => this.onScrollVisibilityChanged());\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, () => this.onDisplayedColumnsChanged());\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, () => this.onDisplayedColumnsWidthChanged());\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_ROWS_CHANGED, (params) => this.onDisplayedRowsChanged(params.afterScroll));\n this.onScrollVisibilityChanged();\n this.onDisplayedColumnsChanged();\n this.onDisplayedColumnsWidthChanged();\n this.onDisplayedRowsChanged();\n }\n listenOnDomOrder() {\n // sticky section must show rows in set order\n const allStickyContainers = [RowContainerName.STICKY_TOP_CENTER, RowContainerName.STICKY_TOP_LEFT, RowContainerName.STICKY_TOP_RIGHT, RowContainerName.STICKY_TOP_FULL_WIDTH];\n const isStickContainer = allStickyContainers.indexOf(this.name) >= 0;\n if (isStickContainer) {\n this.comp.setDomOrder(true);\n return;\n }\n const listener = () => {\n const isEnsureDomOrder = this.gridOptionsService.is('ensureDomOrder');\n const isPrintLayout = this.gridOptionsService.isDomLayout('print');\n this.comp.setDomOrder(isEnsureDomOrder || isPrintLayout);\n };\n this.addManagedPropertyListener('domLayout', listener);\n listener();\n }\n // when editing a pinned row, if the cell is half outside the scrollable area, the browser can\n // scroll the column into view. we do not want this, the pinned sections should never scroll.\n // so we listen to scrolls on these containers and reset the scroll if we find one.\n stopHScrollOnPinnedRows() {\n this.forContainers([RowContainerName.TOP_CENTER, RowContainerName.STICKY_TOP_CENTER, RowContainerName.BOTTOM_CENTER], () => {\n const resetScrollLeft = () => this.eViewport.scrollLeft = 0;\n this.addManagedListener(this.eViewport, 'scroll', resetScrollLeft);\n });\n }\n onDisplayedColumnsChanged() {\n this.forContainers([RowContainerName.CENTER], () => this.onHorizontalViewportChanged());\n }\n onDisplayedColumnsWidthChanged() {\n this.forContainers([RowContainerName.CENTER], () => this.onHorizontalViewportChanged());\n }\n onScrollVisibilityChanged() {\n const scrollWidth = this.gridOptionsService.getScrollbarWidth() || 0;\n if (this.name === RowContainerName.CENTER) {\n const visible = this.scrollVisibleService.isHorizontalScrollShowing();\n const scrollbarWidth = visible ? scrollWidth : 0;\n const size = scrollbarWidth == 0 ? '100%' : `calc(100% + ${scrollbarWidth}px)`;\n this.animationFrameService.requestAnimationFrame(() => this.comp.setViewportHeight(size));\n }\n if (this.name === RowContainerName.FULL_WIDTH) {\n const pad = isInvisibleScrollbar() ? 16 : 0;\n const size = `calc(100% - ${pad}px)`;\n this.eContainer.style.setProperty('width', size);\n }\n }\n // this methods prevents the grid views from being scrolled while the dragService is being used\n // eg. the view should not scroll up and down while dragging rows using the rowDragComp.\n addPreventScrollWhileDragging() {\n const preventScroll = (e) => {\n if (this.dragService.isDragging()) {\n if (e.cancelable) {\n e.preventDefault();\n }\n }\n };\n this.eContainer.addEventListener('touchmove', preventScroll, { passive: false });\n this.addDestroyFunc(() => this.eContainer.removeEventListener('touchmove', preventScroll));\n }\n // this gets called whenever a change in the viewport, so we can inform column controller it has to work\n // out the virtual columns again. gets called from following locations:\n // + ensureColVisible, scroll, init, layoutChanged, displayedColumnsChanged\n onHorizontalViewportChanged() {\n const scrollWidth = this.getCenterWidth();\n const scrollPosition = this.getCenterViewportScrollLeft();\n this.columnModel.setViewportPosition(scrollWidth, scrollPosition);\n }\n getCenterWidth() {\n return getInnerWidth(this.eViewport);\n }\n getCenterViewportScrollLeft() {\n // we defer to a util, as how you calculated scrollLeft when doing RTL depends on the browser\n return getScrollLeft(this.eViewport, this.enableRtl);\n }\n registerViewportResizeListener(listener) {\n const unsubscribeFromResize = this.resizeObserverService.observeResize(this.eViewport, listener);\n this.addDestroyFunc(() => unsubscribeFromResize());\n }\n isViewportVisible() {\n return isVisible(this.eViewport);\n }\n getViewportScrollLeft() {\n return getScrollLeft(this.eViewport, this.enableRtl);\n }\n isHorizontalScrollShowing() {\n const isAlwaysShowHorizontalScroll = this.gridOptionsService.is('alwaysShowHorizontalScroll');\n return isAlwaysShowHorizontalScroll || isHorizontalScrollShowing(this.eViewport);\n }\n getViewportElement() {\n return this.eViewport;\n }\n setContainerTranslateX(amount) {\n this.eContainer.style.transform = `translateX(${amount}px)`;\n }\n getHScrollPosition() {\n const res = {\n left: this.eViewport.scrollLeft,\n right: this.eViewport.scrollLeft + this.eViewport.offsetWidth\n };\n return res;\n }\n setCenterViewportScrollLeft(value) {\n // we defer to a util, as how you calculated scrollLeft when doing RTL depends on the browser\n setScrollLeft(this.eViewport, value, this.enableRtl);\n }\n isContainerVisible() {\n const pinned = RowContainerCtrl.getPinned(this.name);\n return !pinned || (!!this.pinnedWidthFeature && this.pinnedWidthFeature.getWidth() > 0);\n }\n onPinnedWidthChanged() {\n const visible = this.isContainerVisible();\n if (this.visible != visible) {\n this.visible = visible;\n this.onDisplayedRowsChanged();\n }\n if (isInvisibleScrollbar()) {\n this.refreshPaddingForFakeScrollbar();\n }\n }\n onDisplayedRowsChanged(useFlushSync = false) {\n if (this.visible) {\n const printLayout = this.gridOptionsService.isDomLayout('print');\n // this just justifies if the ctrl is in the correct place, this will be fed with zombie rows by the\n // row renderer, so should not block them as they still need to animate - the row renderer\n // will clean these up when they finish animating\n const doesRowMatch = (rowCtrl) => {\n const fullWidthRow = rowCtrl.isFullWidth();\n const embedFW = this.embedFullWidthRows || printLayout;\n const match = this.isFullWithContainer ?\n !embedFW && fullWidthRow\n : embedFW || !fullWidthRow;\n return match;\n };\n // this list contains either all pinned top, center or pinned bottom rows\n // this filters out rows not for this container, eg if it's a full with row, but we are not full with container\n const rowsThisContainer = this.getRowCtrls().filter(doesRowMatch);\n this.comp.setRowCtrls(rowsThisContainer, useFlushSync);\n }\n else {\n this.comp.setRowCtrls(this.EMPTY_CTRLS, false);\n }\n }\n getRowCtrls() {\n switch (this.name) {\n case RowContainerName.TOP_CENTER:\n case RowContainerName.TOP_LEFT:\n case RowContainerName.TOP_RIGHT:\n case RowContainerName.TOP_FULL_WIDTH:\n return this.rowRenderer.getTopRowCtrls();\n case RowContainerName.STICKY_TOP_CENTER:\n case RowContainerName.STICKY_TOP_LEFT:\n case RowContainerName.STICKY_TOP_RIGHT:\n case RowContainerName.STICKY_TOP_FULL_WIDTH:\n return this.rowRenderer.getStickyTopRowCtrls();\n case RowContainerName.BOTTOM_CENTER:\n case RowContainerName.BOTTOM_LEFT:\n case RowContainerName.BOTTOM_RIGHT:\n case RowContainerName.BOTTOM_FULL_WIDTH:\n return this.rowRenderer.getBottomRowCtrls();\n default:\n return this.rowRenderer.getCentreRowCtrls();\n }\n }\n}\n__decorate([\n Autowired('scrollVisibleService')\n], RowContainerCtrl.prototype, \"scrollVisibleService\", void 0);\n__decorate([\n Autowired('dragService')\n], RowContainerCtrl.prototype, \"dragService\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], RowContainerCtrl.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('columnModel')\n], RowContainerCtrl.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('resizeObserverService')\n], RowContainerCtrl.prototype, \"resizeObserverService\", void 0);\n__decorate([\n Autowired('animationFrameService')\n], RowContainerCtrl.prototype, \"animationFrameService\", void 0);\n__decorate([\n Autowired('rowRenderer')\n], RowContainerCtrl.prototype, \"rowRenderer\", void 0);\n__decorate([\n PostConstruct\n], RowContainerCtrl.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Optional, PostConstruct } from '../context/context.mjs';\nimport { LayoutCssClasses } from \"../styling/layoutFeature.mjs\";\nimport { setAriaColCount, setAriaMultiSelectable, setAriaRowCount } from '../utils/aria.mjs';\nimport { Component } from '../widgets/component.mjs';\nimport { RefSelector } from '../widgets/componentAnnotations.mjs';\nimport { CSS_CLASS_FORCE_VERTICAL_SCROLL, GridBodyCtrl, RowAnimationCssClasses } from \"./gridBodyCtrl.mjs\";\nimport { RowContainerName } from \"./rowContainer/rowContainerCtrl.mjs\";\nconst GRID_BODY_TEMPLATE = /* html */ `
\n \n
\n \n \n \n \n
\n
\n
\n
\n \n \n \n \n
\n
\n \n
\n
\n \n \n \n \n
\n
\n \n \n \n \n
\n \n \n
`;\nexport class GridBodyComp extends Component {\n constructor() {\n super(GRID_BODY_TEMPLATE);\n }\n init() {\n const setHeight = (height, element) => {\n const heightString = `${height}px`;\n element.style.minHeight = heightString;\n element.style.height = heightString;\n };\n const compProxy = {\n setRowAnimationCssOnBodyViewport: (cssClass, animate) => this.setRowAnimationCssOnBodyViewport(cssClass, animate),\n setColumnCount: count => setAriaColCount(this.getGui(), count),\n setRowCount: count => setAriaRowCount(this.getGui(), count),\n setTopHeight: height => setHeight(height, this.eTop),\n setBottomHeight: height => setHeight(height, this.eBottom),\n setTopDisplay: display => this.eTop.style.display = display,\n setBottomDisplay: display => this.eBottom.style.display = display,\n setStickyTopHeight: height => this.eStickyTop.style.height = height,\n setStickyTopTop: top => this.eStickyTop.style.top = top,\n setStickyTopWidth: width => this.eStickyTop.style.width = width,\n setColumnMovingCss: (cssClass, flag) => this.addOrRemoveCssClass(cssClass, flag),\n updateLayoutClasses: (cssClass, params) => {\n const classLists = [\n this.eBodyViewport.classList,\n this.eBodyClipper.classList,\n this.eBody.classList\n ];\n classLists.forEach(classList => {\n classList.toggle(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);\n classList.toggle(LayoutCssClasses.NORMAL, params.normal);\n classList.toggle(LayoutCssClasses.PRINT, params.print);\n });\n this.addOrRemoveCssClass(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);\n this.addOrRemoveCssClass(LayoutCssClasses.NORMAL, params.normal);\n this.addOrRemoveCssClass(LayoutCssClasses.PRINT, params.print);\n },\n setAlwaysVerticalScrollClass: (cssClass, on) => this.eBodyViewport.classList.toggle(CSS_CLASS_FORCE_VERTICAL_SCROLL, on),\n registerBodyViewportResizeListener: listener => {\n const unsubscribeFromResize = this.resizeObserverService.observeResize(this.eBodyViewport, listener);\n this.addDestroyFunc(() => unsubscribeFromResize());\n },\n setPinnedTopBottomOverflowY: overflow => this.eTop.style.overflowY = this.eBottom.style.overflowY = overflow,\n setCellSelectableCss: (cssClass, selectable) => {\n [this.eTop, this.eBodyViewport, this.eBottom]\n .forEach(ct => ct.classList.toggle(cssClass, selectable));\n },\n setBodyViewportWidth: width => this.eBodyViewport.style.width = width\n };\n this.ctrl = this.createManagedBean(new GridBodyCtrl());\n this.ctrl.setComp(compProxy, this.getGui(), this.eBodyViewport, this.eTop, this.eBottom, this.eStickyTop);\n if (this.rangeService || this.gridOptionsService.get('rowSelection') === 'multiple') {\n setAriaMultiSelectable(this.getGui(), true);\n }\n }\n setRowAnimationCssOnBodyViewport(cssClass, animateRows) {\n const bodyViewportClassList = this.eBodyViewport.classList;\n bodyViewportClassList.toggle(RowAnimationCssClasses.ANIMATION_ON, animateRows);\n bodyViewportClassList.toggle(RowAnimationCssClasses.ANIMATION_OFF, !animateRows);\n }\n getFloatingTopBottom() {\n return [this.eTop, this.eBottom];\n }\n}\n__decorate([\n Autowired('resizeObserverService')\n], GridBodyComp.prototype, \"resizeObserverService\", void 0);\n__decorate([\n Optional('rangeService')\n], GridBodyComp.prototype, \"rangeService\", void 0);\n__decorate([\n RefSelector('eBodyViewport')\n], GridBodyComp.prototype, \"eBodyViewport\", void 0);\n__decorate([\n RefSelector('eStickyTop')\n], GridBodyComp.prototype, \"eStickyTop\", void 0);\n__decorate([\n RefSelector('eTop')\n], GridBodyComp.prototype, \"eTop\", void 0);\n__decorate([\n RefSelector('eBottom')\n], GridBodyComp.prototype, \"eBottom\", void 0);\n__decorate([\n RefSelector('gridHeader')\n], GridBodyComp.prototype, \"headerRootComp\", void 0);\n__decorate([\n RefSelector('eBodyClipper')\n], GridBodyComp.prototype, \"eBodyClipper\", void 0);\n__decorate([\n RefSelector('eBody')\n], GridBodyComp.prototype, \"eBody\", void 0);\n__decorate([\n PostConstruct\n], GridBodyComp.prototype, \"init\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean, Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Events } from \"../events.mjs\";\nlet ScrollVisibleService = class ScrollVisibleService extends BeanStub {\n postConstruct() {\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onDisplayedColumnsWidthChanged.bind(this));\n }\n onDisplayedColumnsChanged() {\n this.update();\n }\n onDisplayedColumnsWidthChanged() {\n this.update();\n }\n update() {\n // because of column animation (which takes 200ms), we have to do this twice.\n // eg if user removes cols anywhere except at the RHS, then the cols on the RHS\n // will animate to the left to fill the gap. this animation means just after\n // the cols are removed, the remaining cols are still in the original location\n // at the start of the animation, so pre animation the H scrollbar is still needed,\n // but post animation it is not.\n this.updateImpl();\n setTimeout(this.updateImpl.bind(this), 500);\n }\n updateImpl() {\n const centerRowCtrl = this.ctrlsService.getCenterRowContainerCtrl();\n if (!centerRowCtrl) {\n return;\n }\n const params = {\n horizontalScrollShowing: centerRowCtrl.isHorizontalScrollShowing(),\n verticalScrollShowing: this.isVerticalScrollShowing()\n };\n this.setScrollsVisible(params);\n }\n setScrollsVisible(params) {\n const atLeastOneDifferent = this.horizontalScrollShowing !== params.horizontalScrollShowing ||\n this.verticalScrollShowing !== params.verticalScrollShowing;\n if (atLeastOneDifferent) {\n this.horizontalScrollShowing = params.horizontalScrollShowing;\n this.verticalScrollShowing = params.verticalScrollShowing;\n const event = {\n type: Events.EVENT_SCROLL_VISIBILITY_CHANGED\n };\n this.eventService.dispatchEvent(event);\n }\n }\n // used by pagination service - to know page height\n isHorizontalScrollShowing() {\n return this.horizontalScrollShowing;\n }\n // used by header container\n isVerticalScrollShowing() {\n return this.verticalScrollShowing;\n }\n};\n__decorate([\n Autowired('ctrlsService')\n], ScrollVisibleService.prototype, \"ctrlsService\", void 0);\n__decorate([\n PostConstruct\n], ScrollVisibleService.prototype, \"postConstruct\", null);\nScrollVisibleService = __decorate([\n Bean('scrollVisibleService')\n], ScrollVisibleService);\nexport { ScrollVisibleService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar MouseEventService_1;\nimport { Bean } from \"../context/context.mjs\";\nimport { Autowired } from \"../context/context.mjs\";\nimport { NumberSequence } from '../utils/index.mjs';\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { getCtrlForEventTarget } from \"../utils/event.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nimport { CellCtrl } from \"../rendering/cell/cellCtrl.mjs\";\nlet MouseEventService = MouseEventService_1 = class MouseEventService extends BeanStub {\n constructor() {\n super(...arguments);\n this.gridInstanceId = MouseEventService_1.gridInstanceSequence.next();\n }\n // we put the instance id onto the main DOM element. this is used for events, when grids are inside grids,\n // so the grid can work out if the even came from this grid or a grid inside this one. see the ctrl+v logic\n // for where this is used.\n stampTopLevelGridCompWithGridInstance(eGridDiv) {\n eGridDiv[MouseEventService_1.GRID_DOM_KEY] = this.gridInstanceId;\n }\n getRenderedCellForEvent(event) {\n return getCtrlForEventTarget(this.gridOptionsService, event.target, CellCtrl.DOM_DATA_KEY_CELL_CTRL);\n }\n // walks the path of the event, and returns true if this grid is the first one that it finds. if doing\n // master / detail grids, and a child grid is found, then it returns false. this stops things like copy/paste\n // getting executed on many grids at the same time.\n isEventFromThisGrid(event) {\n const res = this.isElementInThisGrid(event.target);\n return res;\n }\n isElementInThisGrid(element) {\n let pointer = element;\n while (pointer) {\n const instanceId = pointer[MouseEventService_1.GRID_DOM_KEY];\n if (exists(instanceId)) {\n const eventFromThisGrid = instanceId === this.gridInstanceId;\n return eventFromThisGrid;\n }\n pointer = pointer.parentElement;\n }\n return false;\n }\n getCellPositionForEvent(event) {\n const cellComp = this.getRenderedCellForEvent(event);\n return cellComp ? cellComp.getCellPosition() : null;\n }\n getNormalisedPosition(event) {\n const gridPanelHasScrolls = this.gridOptionsService.isDomLayout('normal');\n const e = event;\n let x;\n let y;\n if (e.clientX != null || e.clientY != null) {\n x = e.clientX;\n y = e.clientY;\n }\n else {\n x = e.x;\n y = e.y;\n }\n if (gridPanelHasScrolls) {\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n const vRange = gridBodyCon.getScrollFeature().getVScrollPosition();\n const hRange = gridBodyCon.getScrollFeature().getHScrollPosition();\n x += hRange.left;\n y += vRange.top;\n }\n return { x, y };\n }\n};\nMouseEventService.gridInstanceSequence = new NumberSequence();\nMouseEventService.GRID_DOM_KEY = '__ag_grid_instance';\n__decorate([\n Autowired('ctrlsService')\n], MouseEventService.prototype, \"ctrlsService\", void 0);\nMouseEventService = MouseEventService_1 = __decorate([\n Bean('mouseEventService')\n], MouseEventService);\nexport { MouseEventService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, Optional, PostConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { exists, missing } from \"../utils/generic.mjs\";\nimport { last } from \"../utils/array.mjs\";\nimport { KeyCode } from '../constants/keyCode.mjs';\nimport { CellCtrl } from \"../rendering/cell/cellCtrl.mjs\";\nimport { RowCtrl } from \"../rendering/row/rowCtrl.mjs\";\nimport { doOnce, throttle } from \"../utils/function.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nlet NavigationService = class NavigationService extends BeanStub {\n constructor() {\n super();\n this.onPageDown = throttle(this.onPageDown, 100);\n this.onPageUp = throttle(this.onPageUp, 100);\n }\n postConstruct() {\n this.ctrlsService.whenReady(p => {\n this.gridBodyCon = p.gridBodyCtrl;\n });\n }\n handlePageScrollingKey(event, fromFullWidth = false) {\n const key = event.key;\n const alt = event.altKey;\n const ctrl = event.ctrlKey || event.metaKey;\n const rangeServiceShouldHandleShift = !!this.rangeService && event.shiftKey;\n // home and end can be processed without knowing the currently selected cell, this can occur for full width rows.\n const currentCell = this.mouseEventService.getCellPositionForEvent(event);\n let processed = false;\n switch (key) {\n case KeyCode.PAGE_HOME:\n case KeyCode.PAGE_END:\n // handle home and end when ctrl & alt are NOT pressed\n if (!ctrl && !alt) {\n this.onHomeOrEndKey(key);\n processed = true;\n }\n break;\n case KeyCode.LEFT:\n case KeyCode.RIGHT:\n case KeyCode.UP:\n case KeyCode.DOWN:\n if (!currentCell) {\n return false;\n }\n // handle when ctrl is pressed only, if shift is pressed\n // it will be handled by the rangeService\n if (ctrl && !alt && !rangeServiceShouldHandleShift) {\n this.onCtrlUpDownLeftRight(key, currentCell);\n processed = true;\n }\n break;\n case KeyCode.PAGE_DOWN:\n case KeyCode.PAGE_UP:\n // handle page up and page down when ctrl & alt are NOT pressed\n if (!ctrl && !alt) {\n processed = this.handlePageUpDown(key, currentCell, fromFullWidth);\n }\n break;\n }\n if (processed) {\n event.preventDefault();\n }\n return processed;\n }\n handlePageUpDown(key, currentCell, fromFullWidth) {\n if (fromFullWidth) {\n currentCell = this.focusService.getFocusedCell();\n }\n if (!currentCell) {\n return false;\n }\n if (key === KeyCode.PAGE_UP) {\n this.onPageUp(currentCell);\n }\n else {\n this.onPageDown(currentCell);\n }\n return true;\n }\n navigateTo(navigateParams) {\n const { scrollIndex, scrollType, scrollColumn, focusIndex, focusColumn } = navigateParams;\n if (exists(scrollColumn) && !scrollColumn.isPinned()) {\n this.gridBodyCon.getScrollFeature().ensureColumnVisible(scrollColumn);\n }\n if (exists(scrollIndex)) {\n this.gridBodyCon.getScrollFeature().ensureIndexVisible(scrollIndex, scrollType);\n }\n // setFocusedCell relies on the browser default focus behavior to scroll the focused cell into view,\n // however, this behavior will cause the cell border to be cut off, or if we have sticky rows, the\n // cell will be completely hidden, so we call ensureIndexVisible without a position to guarantee\n // minimal scroll to get the row into view.\n if (!navigateParams.isAsync) {\n this.gridBodyCon.getScrollFeature().ensureIndexVisible(focusIndex);\n }\n // if we don't do this, the range will be left on the last cell, which will leave the last focused cell\n // highlighted.\n this.focusService.setFocusedCell({ rowIndex: focusIndex, column: focusColumn, rowPinned: null, forceBrowserFocus: true });\n if (this.rangeService) {\n const cellPosition = { rowIndex: focusIndex, rowPinned: null, column: focusColumn };\n this.rangeService.setRangeToCell(cellPosition);\n }\n }\n // this method is throttled, see the `constructor`\n onPageDown(gridCell) {\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n const scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();\n const pixelsInOnePage = this.getViewportHeight();\n const pagingPixelOffset = this.paginationProxy.getPixelOffset();\n const currentPageBottomPixel = scrollPosition.top + pixelsInOnePage;\n const currentPageBottomRow = this.paginationProxy.getRowIndexAtPixel(currentPageBottomPixel + pagingPixelOffset);\n if (this.columnModel.isAutoRowHeightActive()) {\n this.navigateToNextPageWithAutoHeight(gridCell, currentPageBottomRow);\n }\n else {\n this.navigateToNextPage(gridCell, currentPageBottomRow);\n }\n }\n // this method is throttled, see the `constructor`\n onPageUp(gridCell) {\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n const scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();\n const pagingPixelOffset = this.paginationProxy.getPixelOffset();\n const currentPageTopPixel = scrollPosition.top;\n const currentPageTopRow = this.paginationProxy.getRowIndexAtPixel(currentPageTopPixel + pagingPixelOffset);\n if (this.columnModel.isAutoRowHeightActive()) {\n this.navigateToNextPageWithAutoHeight(gridCell, currentPageTopRow, true);\n }\n else {\n this.navigateToNextPage(gridCell, currentPageTopRow, true);\n }\n }\n navigateToNextPage(gridCell, scrollIndex, up = false) {\n const pixelsInOnePage = this.getViewportHeight();\n const firstRow = this.paginationProxy.getPageFirstRow();\n const lastRow = this.paginationProxy.getPageLastRow();\n const pagingPixelOffset = this.paginationProxy.getPixelOffset();\n const currentRowNode = this.paginationProxy.getRow(gridCell.rowIndex);\n const rowPixelDiff = up\n ? ((currentRowNode === null || currentRowNode === void 0 ? void 0 : currentRowNode.rowHeight) - pixelsInOnePage - pagingPixelOffset)\n : (pixelsInOnePage - pagingPixelOffset);\n const nextCellPixel = (currentRowNode === null || currentRowNode === void 0 ? void 0 : currentRowNode.rowTop) + rowPixelDiff;\n let focusIndex = this.paginationProxy.getRowIndexAtPixel(nextCellPixel + pagingPixelOffset);\n if (focusIndex === gridCell.rowIndex) {\n const diff = up ? -1 : 1;\n scrollIndex = focusIndex = gridCell.rowIndex + diff;\n }\n let scrollType;\n if (up) {\n scrollType = 'bottom';\n if (focusIndex < firstRow) {\n focusIndex = firstRow;\n }\n if (scrollIndex < firstRow) {\n scrollIndex = firstRow;\n }\n }\n else {\n scrollType = 'top';\n if (focusIndex > lastRow) {\n focusIndex = lastRow;\n }\n if (scrollIndex > lastRow) {\n scrollIndex = lastRow;\n }\n }\n if (this.isRowTallerThanView(focusIndex)) {\n scrollIndex = focusIndex;\n scrollType = 'top';\n }\n this.navigateTo({\n scrollIndex,\n scrollType,\n scrollColumn: null,\n focusIndex,\n focusColumn: gridCell.column\n });\n }\n navigateToNextPageWithAutoHeight(gridCell, scrollIndex, up = false) {\n // because autoHeight will calculate the height of rows after scroll\n // first we scroll towards the required point, then we add a small\n // delay to allow the height to be recalculated, check which index\n // should be focused and then finally navigate to that index.\n // TODO: we should probably have an event fired once to scrollbar has\n // settled and all rowHeights have been calculated instead of relying\n // on a setTimeout of 50ms.\n this.navigateTo({\n scrollIndex: scrollIndex,\n scrollType: up ? 'bottom' : 'top',\n scrollColumn: null,\n focusIndex: scrollIndex,\n focusColumn: gridCell.column\n });\n setTimeout(() => {\n const focusIndex = this.getNextFocusIndexForAutoHeight(gridCell, up);\n this.navigateTo({\n scrollIndex: scrollIndex,\n scrollType: up ? 'bottom' : 'top',\n scrollColumn: null,\n focusIndex: focusIndex,\n focusColumn: gridCell.column,\n isAsync: true\n });\n }, 50);\n }\n getNextFocusIndexForAutoHeight(gridCell, up = false) {\n var _a;\n const step = up ? -1 : 1;\n const pixelsInOnePage = this.getViewportHeight();\n const lastRowIndex = this.paginationProxy.getPageLastRow();\n let pixelSum = 0;\n let currentIndex = gridCell.rowIndex;\n while (currentIndex >= 0 && currentIndex <= lastRowIndex) {\n const currentCell = this.paginationProxy.getRow(currentIndex);\n if (currentCell) {\n const currentCellHeight = (_a = currentCell.rowHeight) !== null && _a !== void 0 ? _a : 0;\n if (pixelSum + currentCellHeight > pixelsInOnePage) {\n break;\n }\n pixelSum += currentCellHeight;\n }\n currentIndex += step;\n }\n return Math.max(0, Math.min(currentIndex, lastRowIndex));\n }\n getViewportHeight() {\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n const scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();\n const scrollbarWidth = this.gridOptionsService.getScrollbarWidth();\n let pixelsInOnePage = scrollPosition.bottom - scrollPosition.top;\n if (this.ctrlsService.getCenterRowContainerCtrl().isHorizontalScrollShowing()) {\n pixelsInOnePage -= scrollbarWidth;\n }\n return pixelsInOnePage;\n }\n isRowTallerThanView(rowIndex) {\n const rowNode = this.paginationProxy.getRow(rowIndex);\n if (!rowNode) {\n return false;\n }\n const rowHeight = rowNode.rowHeight;\n if (typeof rowHeight !== 'number') {\n return false;\n }\n return rowHeight > this.getViewportHeight();\n }\n onCtrlUpDownLeftRight(key, gridCell) {\n const cellToFocus = this.cellNavigationService.getNextCellToFocus(key, gridCell, true);\n const { rowIndex, column } = cellToFocus;\n this.navigateTo({\n scrollIndex: rowIndex,\n scrollType: null,\n scrollColumn: column,\n focusIndex: rowIndex,\n focusColumn: column\n });\n }\n // home brings focus to top left cell, end brings focus to bottom right, grid scrolled to bring\n // same cell into view (which means either scroll all the way up, or all the way down).\n onHomeOrEndKey(key) {\n const homeKey = key === KeyCode.PAGE_HOME;\n const allColumns = this.columnModel.getAllDisplayedColumns();\n const columnToSelect = homeKey ? allColumns[0] : last(allColumns);\n const scrollIndex = homeKey ? this.paginationProxy.getPageFirstRow() : this.paginationProxy.getPageLastRow();\n this.navigateTo({\n scrollIndex: scrollIndex,\n scrollType: null,\n scrollColumn: columnToSelect,\n focusIndex: scrollIndex,\n focusColumn: columnToSelect\n });\n }\n // result of keyboard event\n onTabKeyDown(previous, keyboardEvent) {\n const backwards = keyboardEvent.shiftKey;\n const movedToNextCell = this.tabToNextCellCommon(previous, backwards, keyboardEvent);\n if (movedToNextCell) {\n // only prevent default if we found a cell. so if user is on last cell and hits tab, then we default\n // to the normal tabbing so user can exit the grid.\n keyboardEvent.preventDefault();\n return;\n }\n // if we didn't move to next cell, then need to tab out of the cells, ie to the header (if going\n // backwards)\n if (backwards) {\n const { rowIndex, rowPinned } = previous.getRowPosition();\n const firstRow = rowPinned ? rowIndex === 0 : rowIndex === this.paginationProxy.getPageFirstRow();\n if (firstRow) {\n if (this.gridOptionsService.getNum('headerHeight') === 0) {\n this.focusService.focusNextGridCoreContainer(true, true);\n }\n else {\n keyboardEvent.preventDefault();\n this.focusService.focusPreviousFromFirstCell(keyboardEvent);\n }\n }\n }\n else {\n // if the case it's a popup editor, the focus is on the editor and not the previous cell.\n // in order for the tab navigation to work, we need to focus the browser back onto the\n // previous cell.\n if (previous instanceof CellCtrl) {\n previous.focusCell(true);\n }\n if (this.focusService.focusNextGridCoreContainer(backwards)) {\n keyboardEvent.preventDefault();\n }\n }\n }\n // comes from API\n tabToNextCell(backwards, event) {\n const focusedCell = this.focusService.getFocusedCell();\n // if no focus, then cannot navigate\n if (!focusedCell) {\n return false;\n }\n let cellOrRow = this.getCellByPosition(focusedCell);\n // if cell is not rendered, means user has scrolled away from the cell\n // or that the focusedCell is a Full Width Row\n if (!cellOrRow) {\n cellOrRow = this.rowRenderer.getRowByPosition(focusedCell);\n if (!cellOrRow || !cellOrRow.isFullWidth()) {\n return false;\n }\n }\n return this.tabToNextCellCommon(cellOrRow, backwards, event);\n }\n tabToNextCellCommon(previous, backwards, event) {\n let editing = previous.isEditing();\n // if cell is not editing, there is still chance row is editing if it's Full Row Editing\n if (!editing && previous instanceof CellCtrl) {\n const cell = previous;\n const row = cell.getRowCtrl();\n if (row) {\n editing = row.isEditing();\n }\n }\n let res;\n if (editing) {\n // if we are editing, we know it's not a Full Width Row (RowComp)\n if (this.gridOptionsService.get('editType') === 'fullRow') {\n res = this.moveToNextEditingRow(previous, backwards, event);\n }\n else {\n res = this.moveToNextEditingCell(previous, backwards, event);\n }\n }\n else {\n res = this.moveToNextCellNotEditing(previous, backwards);\n }\n // if a cell wasn't found, it's possible that focus was moved to the header\n return res || !!this.focusService.getFocusedHeader();\n }\n moveToNextEditingCell(previousCell, backwards, event = null) {\n const previousPos = previousCell.getCellPosition();\n // before we stop editing, we need to focus the cell element\n // so the grid doesn't detect that focus has left the grid\n previousCell.getGui().focus();\n // need to do this before getting next cell to edit, in case the next cell\n // has editable function (eg colDef.editable=func() ) and it depends on the\n // result of this cell, so need to save updates from the first edit, in case\n // the value is referenced in the function.\n previousCell.stopEditing();\n // find the next cell to start editing\n const nextCell = this.findNextCellToFocusOn(previousPos, backwards, true);\n if (nextCell == null) {\n return false;\n }\n // only prevent default if we found a cell. so if user is on last cell and hits tab, then we default\n // to the normal tabbing so user can exit the grid.\n nextCell.startEditing(null, true, event);\n nextCell.focusCell(false);\n return true;\n }\n moveToNextEditingRow(previousCell, backwards, event = null) {\n const previousPos = previousCell.getCellPosition();\n // find the next cell to start editing\n const nextCell = this.findNextCellToFocusOn(previousPos, backwards, true);\n if (nextCell == null) {\n return false;\n }\n const nextPos = nextCell.getCellPosition();\n const previousEditable = this.isCellEditable(previousPos);\n const nextEditable = this.isCellEditable(nextPos);\n const rowsMatch = nextPos && previousPos.rowIndex === nextPos.rowIndex && previousPos.rowPinned === nextPos.rowPinned;\n if (previousEditable) {\n previousCell.setFocusOutOnEditor();\n }\n if (!rowsMatch) {\n const pRow = previousCell.getRowCtrl();\n pRow.stopEditing();\n const nRow = nextCell.getRowCtrl();\n nRow.startRowEditing(undefined, undefined, event);\n }\n if (nextEditable) {\n nextCell.setFocusInOnEditor();\n nextCell.focusCell();\n }\n else {\n nextCell.focusCell(true);\n }\n return true;\n }\n moveToNextCellNotEditing(previousCell, backwards) {\n const displayedColumns = this.columnModel.getAllDisplayedColumns();\n let cellPos;\n if (previousCell instanceof RowCtrl) {\n cellPos = Object.assign(Object.assign({}, previousCell.getRowPosition()), { column: backwards ? displayedColumns[0] : last(displayedColumns) });\n }\n else {\n cellPos = previousCell.getCellPosition();\n }\n // find the next cell to start editing\n const nextCell = this.findNextCellToFocusOn(cellPos, backwards, false);\n // only prevent default if we found a cell. so if user is on last cell and hits tab, then we default\n // to the normal tabbing so user can exit the grid.\n if (nextCell instanceof CellCtrl) {\n nextCell.focusCell(true);\n }\n else if (nextCell) {\n return this.tryToFocusFullWidthRow(nextCell.getRowPosition(), backwards);\n }\n return exists(nextCell);\n }\n // called by the cell, when tab is pressed while editing.\n // @return: RenderedCell when navigation successful, otherwise null\n findNextCellToFocusOn(previousPosition, backwards, startEditing) {\n let nextPosition = previousPosition;\n while (true) {\n if (previousPosition !== nextPosition) {\n previousPosition = nextPosition;\n }\n if (!backwards) {\n nextPosition = this.getLastCellOfColSpan(nextPosition);\n }\n nextPosition = this.cellNavigationService.getNextTabbedCell(nextPosition, backwards);\n // allow user to override what cell to go to next\n const userFunc = this.gridOptionsService.getCallback('tabToNextCell');\n if (exists(userFunc)) {\n const params = {\n backwards: backwards,\n editing: startEditing,\n previousCellPosition: previousPosition,\n nextCellPosition: nextPosition ? nextPosition : null\n };\n const userCell = userFunc(params);\n if (exists(userCell)) {\n if (userCell.floating) {\n doOnce(() => { console.warn(`AG Grid: tabToNextCellFunc return type should have attributes: rowIndex, rowPinned, column. However you had 'floating', maybe you meant 'rowPinned'?`); }, 'no floating in userCell');\n userCell.rowPinned = userCell.floating;\n }\n nextPosition = {\n rowIndex: userCell.rowIndex,\n column: userCell.column,\n rowPinned: userCell.rowPinned\n };\n }\n else {\n nextPosition = null;\n }\n }\n // if no 'next cell', means we have got to last cell of grid, so nothing to move to,\n // so bottom right cell going forwards, or top left going backwards\n if (!nextPosition) {\n return null;\n }\n if (nextPosition.rowIndex < 0) {\n const headerLen = this.headerNavigationService.getHeaderRowCount();\n this.focusService.focusHeaderPosition({\n headerPosition: {\n headerRowIndex: headerLen + (nextPosition.rowIndex),\n column: nextPosition.column\n },\n fromCell: true\n });\n return null;\n }\n // if editing, but cell not editable, skip cell. we do this before we do all of\n // the 'ensure index visible' and 'flush all frames', otherwise if we are skipping\n // a bunch of cells (eg 10 rows) then all the work on ensuring cell visible is useless\n // (except for the last one) which causes grid to stall for a while.\n // note - for full row edit, we do focus non-editable cells, as the row stays in edit mode.\n const fullRowEdit = this.gridOptionsService.get('editType') === 'fullRow';\n if (startEditing && !fullRowEdit) {\n const cellIsEditable = this.isCellEditable(nextPosition);\n if (!cellIsEditable) {\n continue;\n }\n }\n this.ensureCellVisible(nextPosition);\n // we have to call this after ensureColumnVisible - otherwise it could be a virtual column\n // or row that is not currently in view, hence the renderedCell would not exist\n const nextCell = this.getCellByPosition(nextPosition);\n // if next cell is fullWidth row, then no rendered cell,\n // as fullWidth rows have no cells, so we skip it\n if (!nextCell) {\n const row = this.rowRenderer.getRowByPosition(nextPosition);\n if (!row || !row.isFullWidth() || startEditing) {\n continue;\n }\n return row;\n }\n if (nextCell.isSuppressNavigable()) {\n continue;\n }\n // by default, when we click a cell, it gets selected into a range, so to keep keyboard navigation\n // consistent, we set into range here also.\n if (this.rangeService) {\n this.rangeService.setRangeToCell(nextPosition);\n }\n // we successfully tabbed onto a grid cell, so return true\n return nextCell;\n }\n }\n isCellEditable(cell) {\n const rowNode = this.lookupRowNodeForCell(cell);\n if (rowNode) {\n return cell.column.isCellEditable(rowNode);\n }\n return false;\n }\n getCellByPosition(cellPosition) {\n const rowCtrl = this.rowRenderer.getRowByPosition(cellPosition);\n if (!rowCtrl) {\n return null;\n }\n return rowCtrl.getCellCtrl(cellPosition.column);\n }\n lookupRowNodeForCell(cell) {\n if (cell.rowPinned === 'top') {\n return this.pinnedRowModel.getPinnedTopRow(cell.rowIndex);\n }\n if (cell.rowPinned === 'bottom') {\n return this.pinnedRowModel.getPinnedBottomRow(cell.rowIndex);\n }\n return this.paginationProxy.getRow(cell.rowIndex);\n }\n // we use index for rows, but column object for columns, as the next column (by index) might not\n // be visible (header grouping) so it's not reliable, so using the column object instead.\n navigateToNextCell(event, key, currentCell, allowUserOverride) {\n // we keep searching for a next cell until we find one. this is how the group rows get skipped\n let nextCell = currentCell;\n let hitEdgeOfGrid = false;\n while (nextCell && (nextCell === currentCell || !this.isValidNavigateCell(nextCell))) {\n // if the current cell is spanning across multiple columns, we need to move\n // our current position to be the last cell on the right before finding the\n // the next target.\n if (this.gridOptionsService.is('enableRtl')) {\n if (key === KeyCode.LEFT) {\n nextCell = this.getLastCellOfColSpan(nextCell);\n }\n }\n else if (key === KeyCode.RIGHT) {\n nextCell = this.getLastCellOfColSpan(nextCell);\n }\n nextCell = this.cellNavigationService.getNextCellToFocus(key, nextCell);\n // eg if going down, and nextCell=undefined, means we are gone past the last row\n hitEdgeOfGrid = missing(nextCell);\n }\n if (hitEdgeOfGrid && event && event.key === KeyCode.UP) {\n nextCell = {\n rowIndex: -1,\n rowPinned: null,\n column: currentCell.column\n };\n }\n // allow user to override what cell to go to next. when doing normal cell navigation (with keys)\n // we allow this, however if processing 'enter after edit' we don't allow override\n if (allowUserOverride) {\n const userFunc = this.gridOptionsService.getCallback('navigateToNextCell');\n if (exists(userFunc)) {\n const params = {\n key: key,\n previousCellPosition: currentCell,\n nextCellPosition: nextCell ? nextCell : null,\n event: event\n };\n const userCell = userFunc(params);\n if (exists(userCell)) {\n if (userCell.floating) {\n doOnce(() => { console.warn(`AG Grid: tabToNextCellFunc return type should have attributes: rowIndex, rowPinned, column. However you had 'floating', maybe you meant 'rowPinned'?`); }, 'no floating in userCell');\n userCell.rowPinned = userCell.floating;\n }\n nextCell = {\n rowPinned: userCell.rowPinned,\n rowIndex: userCell.rowIndex,\n column: userCell.column\n };\n }\n else {\n nextCell = null;\n }\n }\n }\n // no next cell means we have reached a grid boundary, eg left, right, top or bottom of grid\n if (!nextCell) {\n return;\n }\n if (nextCell.rowIndex < 0) {\n const headerLen = this.headerNavigationService.getHeaderRowCount();\n this.focusService.focusHeaderPosition({\n headerPosition: { headerRowIndex: headerLen + (nextCell.rowIndex), column: currentCell.column },\n event: event || undefined,\n fromCell: true\n });\n return;\n }\n // in case we have col spanning we get the cellComp and use it to get the\n // position. This was we always focus the first cell inside the spanning.\n const normalisedPosition = this.getNormalisedPosition(nextCell);\n if (normalisedPosition) {\n this.focusPosition(normalisedPosition);\n }\n else {\n this.tryToFocusFullWidthRow(nextCell);\n }\n }\n getNormalisedPosition(cellPosition) {\n // ensureCellVisible first, to make sure cell at position is rendered.\n this.ensureCellVisible(cellPosition);\n const cellCtrl = this.getCellByPosition(cellPosition);\n // not guaranteed to have a cellComp when using the SSRM as blocks are loading.\n if (!cellCtrl) {\n return null;\n }\n cellPosition = cellCtrl.getCellPosition();\n // we call this again, as nextCell can be different to it's previous value due to Column Spanning\n // (ie if cursor moving from right to left, and cell is spanning columns, then nextCell was the\n // last column in the group, however now it's the first column in the group). if we didn't do\n // ensureCellVisible again, then we could only be showing the last portion (last column) of the\n // merged cells.\n this.ensureCellVisible(cellPosition);\n return cellPosition;\n }\n tryToFocusFullWidthRow(position, backwards = false) {\n const displayedColumns = this.columnModel.getAllDisplayedColumns();\n const rowComp = this.rowRenderer.getRowByPosition(position);\n if (!rowComp || !rowComp.isFullWidth()) {\n return false;\n }\n const currentCellFocused = this.focusService.getFocusedCell();\n const cellPosition = {\n rowIndex: position.rowIndex,\n rowPinned: position.rowPinned,\n column: position.column || (backwards ? last(displayedColumns) : displayedColumns[0])\n };\n this.focusPosition(cellPosition);\n const fromBelow = currentCellFocused != null ? this.rowPositionUtils.before(cellPosition, currentCellFocused) : false;\n const focusEvent = {\n type: Events.EVENT_FULL_WIDTH_ROW_FOCUSED,\n rowIndex: cellPosition.rowIndex,\n rowPinned: cellPosition.rowPinned,\n column: cellPosition.column,\n isFullWidthCell: true,\n floating: cellPosition.rowPinned,\n fromBelow\n };\n this.eventService.dispatchEvent(focusEvent);\n return true;\n }\n focusPosition(cellPosition) {\n this.focusService.setFocusedCell({\n rowIndex: cellPosition.rowIndex,\n column: cellPosition.column,\n rowPinned: cellPosition.rowPinned,\n forceBrowserFocus: true\n });\n if (this.rangeService) {\n this.rangeService.setRangeToCell(cellPosition);\n }\n }\n isValidNavigateCell(cell) {\n const rowNode = this.rowPositionUtils.getRowNode(cell);\n // we do not allow focusing on detail rows and full width rows\n return !!rowNode;\n }\n getLastCellOfColSpan(cell) {\n const cellCtrl = this.getCellByPosition(cell);\n if (!cellCtrl) {\n return cell;\n }\n const colSpanningList = cellCtrl.getColSpanningList();\n if (colSpanningList.length === 1) {\n return cell;\n }\n return {\n rowIndex: cell.rowIndex,\n column: last(colSpanningList),\n rowPinned: cell.rowPinned\n };\n }\n ensureCellVisible(gridCell) {\n const isGroupStickyEnabled = this.gridOptionsService.isGroupRowsSticky();\n const rowNode = this.rowModel.getRow(gridCell.rowIndex);\n // sticky rows are always visible, so the grid shouldn't scroll to focus them.\n const skipScrollToRow = isGroupStickyEnabled && (rowNode === null || rowNode === void 0 ? void 0 : rowNode.sticky);\n // this scrolls the row into view\n if (!skipScrollToRow && missing(gridCell.rowPinned)) {\n this.gridBodyCon.getScrollFeature().ensureIndexVisible(gridCell.rowIndex);\n }\n if (!gridCell.column.isPinned()) {\n this.gridBodyCon.getScrollFeature().ensureColumnVisible(gridCell.column);\n }\n }\n};\n__decorate([\n Autowired('mouseEventService')\n], NavigationService.prototype, \"mouseEventService\", void 0);\n__decorate([\n Autowired('paginationProxy')\n], NavigationService.prototype, \"paginationProxy\", void 0);\n__decorate([\n Autowired('focusService')\n], NavigationService.prototype, \"focusService\", void 0);\n__decorate([\n Optional('rangeService')\n], NavigationService.prototype, \"rangeService\", void 0);\n__decorate([\n Autowired('columnModel')\n], NavigationService.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('rowModel')\n], NavigationService.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], NavigationService.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('rowRenderer')\n], NavigationService.prototype, \"rowRenderer\", void 0);\n__decorate([\n Autowired('headerNavigationService')\n], NavigationService.prototype, \"headerNavigationService\", void 0);\n__decorate([\n Autowired(\"rowPositionUtils\")\n], NavigationService.prototype, \"rowPositionUtils\", void 0);\n__decorate([\n Autowired(\"cellNavigationService\")\n], NavigationService.prototype, \"cellNavigationService\", void 0);\n__decorate([\n Autowired(\"pinnedRowModel\")\n], NavigationService.prototype, \"pinnedRowModel\", void 0);\n__decorate([\n PostConstruct\n], NavigationService.prototype, \"postConstruct\", null);\nNavigationService = __decorate([\n Bean('navigationService')\n], NavigationService);\nexport { NavigationService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PopupComponent } from \"../../widgets/popupComponent.mjs\";\nimport { isUserSuppressingKeyboardEvent } from \"../../utils/keyboard.mjs\";\nimport { PostConstruct } from \"../../context/context.mjs\";\nexport class PopupEditorWrapper extends PopupComponent {\n constructor(params) {\n super(/* html */ `
`);\n this.params = params;\n }\n postConstruct() {\n this.gridOptionsService.setDomData(this.getGui(), PopupEditorWrapper.DOM_KEY_POPUP_EDITOR_WRAPPER, true);\n this.addKeyDownListener();\n }\n addKeyDownListener() {\n const eGui = this.getGui();\n const params = this.params;\n const listener = (event) => {\n if (!isUserSuppressingKeyboardEvent(this.gridOptionsService, event, params.node, params.column, true)) {\n params.onKeyDown(event);\n }\n };\n this.addManagedListener(eGui, 'keydown', listener);\n }\n}\nPopupEditorWrapper.DOM_KEY_POPUP_EDITOR_WRAPPER = 'popupEditorWrapper';\n__decorate([\n PostConstruct\n], PopupEditorWrapper.prototype, \"postConstruct\", null);\n","import { Component } from \"../../widgets/component.mjs\";\nimport { PopupEditorWrapper } from \"./../cellEditors/popupEditorWrapper.mjs\";\nimport { setAriaRole } from \"../../utils/aria.mjs\";\nimport { escapeString } from \"../../utils/string.mjs\";\nimport { missing } from \"../../utils/generic.mjs\";\nimport { addStylesToElement, clearElement, loadTemplate, removeFromParent } from \"../../utils/dom.mjs\";\nimport { browserSupportsPreventScroll } from \"../../utils/browser.mjs\";\nexport class CellComp extends Component {\n constructor(beans, cellCtrl, printLayout, eRow, editingRow) {\n super();\n // every time we go into edit mode, or back again, this gets incremented.\n // it's the components way of dealing with the async nature of framework components,\n // so if a framework component takes a while to be created, we know if the object\n // is still relevant when creating is finished. eg we could click edit / un-edit 20\n // times before the first React edit component comes back - we should discard\n // the first 19.\n this.rendererVersion = 0;\n this.editorVersion = 0;\n this.beans = beans;\n this.column = cellCtrl.getColumn();\n this.rowNode = cellCtrl.getRowNode();\n this.rowCtrl = cellCtrl.getRowCtrl();\n this.eRow = eRow;\n this.cellCtrl = cellCtrl;\n this.setTemplate(/* html */ `
`);\n const eGui = this.getGui();\n this.forceWrapper = cellCtrl.isForceWrapper();\n this.refreshWrapper(false);\n const setAttribute = (name, value) => {\n if (value != null && value != '') {\n eGui.setAttribute(name, value);\n }\n else {\n eGui.removeAttribute(name);\n }\n };\n setAriaRole(eGui, 'gridcell');\n setAttribute('col-id', cellCtrl.getColumnIdSanitised());\n const tabIndex = cellCtrl.getTabIndex();\n if (tabIndex !== undefined) {\n setAttribute('tabindex', tabIndex.toString());\n }\n const compProxy = {\n addOrRemoveCssClass: (cssClassName, on) => this.addOrRemoveCssClass(cssClassName, on),\n setUserStyles: (styles) => addStylesToElement(eGui, styles),\n getFocusableElement: () => this.getFocusableElement(),\n setIncludeSelection: include => this.includeSelection = include,\n setIncludeRowDrag: include => this.includeRowDrag = include,\n setIncludeDndSource: include => this.includeDndSource = include,\n setRenderDetails: (compDetails, valueToDisplay, force) => this.setRenderDetails(compDetails, valueToDisplay, force),\n setEditDetails: (compDetails, popup, position) => this.setEditDetails(compDetails, popup, position),\n getCellEditor: () => this.cellEditor || null,\n getCellRenderer: () => this.cellRenderer || null,\n getParentOfValue: () => this.getParentOfValue()\n };\n cellCtrl.setComp(compProxy, this.getGui(), this.eCellWrapper, printLayout, editingRow);\n }\n getParentOfValue() {\n if (this.eCellValue) {\n // if not editing, and using wrapper, then value goes in eCellValue\n return this.eCellValue;\n }\n if (this.eCellWrapper) {\n // if editing, and using wrapper, value (cell editor) goes in eCellWrapper\n return this.eCellWrapper;\n }\n // if editing or rendering, and not using wrapper, value (or comp) is directly inside cell\n return this.getGui();\n }\n setRenderDetails(compDetails, valueToDisplay, forceNewCellRendererInstance) {\n // this can happen if the users asks for the cell to refresh, but we are not showing the vale as we are editing\n const isInlineEditing = this.cellEditor && !this.cellEditorPopupWrapper;\n if (isInlineEditing) {\n return;\n }\n // this means firstRender will be true for one pass only, as it's initialised to undefined\n this.firstRender = this.firstRender == null;\n // if display template has changed, means any previous Cell Renderer is in the wrong location\n const controlWrapperChanged = this.refreshWrapper(false);\n this.refreshEditStyles(false);\n // all of these have dependencies on the eGui, so only do them after eGui is set\n if (compDetails) {\n const neverRefresh = forceNewCellRendererInstance || controlWrapperChanged;\n const cellRendererRefreshSuccessful = neverRefresh ? false : this.refreshCellRenderer(compDetails);\n if (!cellRendererRefreshSuccessful) {\n this.destroyRenderer();\n this.createCellRendererInstance(compDetails);\n }\n }\n else {\n this.destroyRenderer();\n this.insertValueWithoutCellRenderer(valueToDisplay);\n }\n }\n setEditDetails(compDetails, popup, position) {\n if (compDetails) {\n this.createCellEditorInstance(compDetails, popup, position);\n }\n else {\n this.destroyEditor();\n }\n }\n removeControls() {\n this.checkboxSelectionComp = this.beans.context.destroyBean(this.checkboxSelectionComp);\n this.dndSourceComp = this.beans.context.destroyBean(this.dndSourceComp);\n this.rowDraggingComp = this.beans.context.destroyBean(this.rowDraggingComp);\n }\n // returns true if wrapper was changed\n refreshWrapper(editing) {\n const providingControls = this.includeRowDrag || this.includeDndSource || this.includeSelection;\n const usingWrapper = providingControls || this.forceWrapper;\n const putWrapperIn = usingWrapper && this.eCellWrapper == null;\n if (putWrapperIn) {\n this.eCellWrapper = loadTemplate(/* html */ `
`);\n this.getGui().appendChild(this.eCellWrapper);\n }\n const takeWrapperOut = !usingWrapper && this.eCellWrapper != null;\n if (takeWrapperOut) {\n removeFromParent(this.eCellWrapper);\n this.eCellWrapper = undefined;\n }\n this.addOrRemoveCssClass('ag-cell-value', !usingWrapper);\n const usingCellValue = !editing && usingWrapper;\n const putCellValueIn = usingCellValue && this.eCellValue == null;\n if (putCellValueIn) {\n this.eCellValue = loadTemplate(/* html */ ``);\n this.eCellWrapper.appendChild(this.eCellValue);\n }\n const takeCellValueOut = !usingCellValue && this.eCellValue != null;\n if (takeCellValueOut) {\n removeFromParent(this.eCellValue);\n this.eCellValue = undefined;\n }\n const templateChanged = putWrapperIn || takeWrapperOut || putCellValueIn || takeCellValueOut;\n if (templateChanged) {\n this.removeControls();\n }\n if (!editing) {\n if (providingControls) {\n this.addControls();\n }\n }\n return templateChanged;\n }\n addControls() {\n if (this.includeRowDrag) {\n if (this.rowDraggingComp == null) {\n this.rowDraggingComp = this.cellCtrl.createRowDragComp();\n if (this.rowDraggingComp) {\n // put the checkbox in before the value\n this.eCellWrapper.insertBefore(this.rowDraggingComp.getGui(), this.eCellValue);\n }\n }\n }\n if (this.includeDndSource) {\n if (this.dndSourceComp == null) {\n this.dndSourceComp = this.cellCtrl.createDndSource();\n // put the checkbox in before the value\n this.eCellWrapper.insertBefore(this.dndSourceComp.getGui(), this.eCellValue);\n }\n }\n if (this.includeSelection) {\n if (this.checkboxSelectionComp == null) {\n this.checkboxSelectionComp = this.cellCtrl.createSelectionCheckbox();\n this.eCellWrapper.insertBefore(this.checkboxSelectionComp.getGui(), this.eCellValue);\n }\n }\n }\n createCellEditorInstance(compDetails, popup, position) {\n const versionCopy = this.editorVersion;\n const cellEditorPromise = compDetails.newAgStackInstance();\n if (!cellEditorPromise) {\n return;\n } // if empty, userComponentFactory already did a console message\n const { params } = compDetails;\n cellEditorPromise.then(c => this.afterCellEditorCreated(versionCopy, c, params, popup, position));\n // if we don't do this, and editor component is async, then there will be a period\n // when the component isn't present and keyboard navigation won't work - so example\n // of user hitting tab quickly (more quickly than renderers getting created) won't work\n const cellEditorAsync = missing(this.cellEditor);\n if (cellEditorAsync && params.cellStartedEdit) {\n this.cellCtrl.focusCell(true);\n }\n }\n insertValueWithoutCellRenderer(valueToDisplay) {\n const eParent = this.getParentOfValue();\n clearElement(eParent);\n const escapedValue = valueToDisplay != null ? escapeString(valueToDisplay) : null;\n if (escapedValue != null) {\n eParent.innerHTML = escapedValue;\n }\n }\n destroyEditorAndRenderer() {\n this.destroyRenderer();\n this.destroyEditor();\n }\n destroyRenderer() {\n const { context } = this.beans;\n this.cellRenderer = context.destroyBean(this.cellRenderer);\n removeFromParent(this.cellRendererGui);\n this.cellRendererGui = null;\n this.rendererVersion++;\n }\n destroyEditor() {\n const { context } = this.beans;\n if (this.hideEditorPopup) {\n this.hideEditorPopup();\n }\n this.hideEditorPopup = undefined;\n this.cellEditor = context.destroyBean(this.cellEditor);\n this.cellEditorPopupWrapper = context.destroyBean(this.cellEditorPopupWrapper);\n removeFromParent(this.cellEditorGui);\n this.cellEditorGui = null;\n this.editorVersion++;\n }\n refreshCellRenderer(compClassAndParams) {\n if (this.cellRenderer == null || this.cellRenderer.refresh == null) {\n return false;\n }\n // if different Cell Renderer configured this time (eg user is using selector, and\n // returns different component) then don't refresh, force recreate of Cell Renderer\n if (this.cellRendererClass !== compClassAndParams.componentClass) {\n return false;\n }\n // take any custom params off of the user\n const result = this.cellRenderer.refresh(compClassAndParams.params);\n // NOTE on undefined: previous version of the cellRenderer.refresh() interface\n // returned nothing, if the method existed, we assumed it refreshed. so for\n // backwards compatibility, we assume if method exists and returns nothing,\n // that it was successful.\n return result === true || result === undefined;\n }\n createCellRendererInstance(compDetails) {\n // never use task service if animation frame service is turned off.\n // and lastly we never use it if doing auto-height, as the auto-height service checks the\n // row height directly after the cell is created, it doesn't wait around for the tasks to complete \n const suppressAnimationFrame = this.beans.gridOptionsService.is('suppressAnimationFrame');\n const useTaskService = !suppressAnimationFrame;\n const displayComponentVersionCopy = this.rendererVersion;\n const { componentClass } = compDetails;\n const createCellRendererFunc = () => {\n const staleTask = this.rendererVersion !== displayComponentVersionCopy || !this.isAlive();\n if (staleTask) {\n return;\n }\n // this can return null in the event that the user has switched from a renderer component to nothing, for example\n // when using a cellRendererSelect to return a component or null depending on row data etc\n const componentPromise = compDetails.newAgStackInstance();\n const callback = this.afterCellRendererCreated.bind(this, displayComponentVersionCopy, componentClass);\n if (componentPromise) {\n componentPromise.then(callback);\n }\n };\n // we only use task service when rendering for first time, which means it is not used when doing edits.\n // if we changed this (always use task service) would make sense, however it would break tests, possibly\n // test of users.\n if (useTaskService && this.firstRender) {\n this.beans.animationFrameService.createTask(createCellRendererFunc, this.rowNode.rowIndex, 'createTasksP2');\n }\n else {\n createCellRendererFunc();\n }\n }\n getCtrl() {\n return this.cellCtrl;\n }\n getRowCtrl() {\n return this.rowCtrl;\n }\n getCellRenderer() {\n return this.cellRenderer;\n }\n getCellEditor() {\n return this.cellEditor;\n }\n afterCellRendererCreated(cellRendererVersion, cellRendererClass, cellRenderer) {\n const staleTask = !this.isAlive() || cellRendererVersion !== this.rendererVersion;\n if (staleTask) {\n this.beans.context.destroyBean(cellRenderer);\n return;\n }\n this.cellRenderer = cellRenderer;\n this.cellRendererClass = cellRendererClass;\n this.cellRendererGui = this.cellRenderer.getGui();\n if (this.cellRendererGui != null) {\n const eParent = this.getParentOfValue();\n clearElement(eParent);\n eParent.appendChild(this.cellRendererGui);\n }\n }\n afterCellEditorCreated(requestVersion, cellEditor, params, popup, position) {\n // if editingCell=false, means user cancelled the editor before component was ready.\n // if versionMismatch, then user cancelled the edit, then started the edit again, and this\n // is the first editor which is now stale.\n const staleComp = requestVersion !== this.editorVersion;\n if (staleComp) {\n this.beans.context.destroyBean(cellEditor);\n return;\n }\n const editingCancelledByUserComp = cellEditor.isCancelBeforeStart && cellEditor.isCancelBeforeStart();\n if (editingCancelledByUserComp) {\n this.beans.context.destroyBean(cellEditor);\n this.cellCtrl.stopEditing(true);\n return;\n }\n if (!cellEditor.getGui) {\n console.warn(`AG Grid: cellEditor for column ${this.column.getId()} is missing getGui() method`);\n this.beans.context.destroyBean(cellEditor);\n return;\n }\n this.cellEditor = cellEditor;\n this.cellEditorGui = cellEditor.getGui();\n const cellEditorInPopup = popup || (cellEditor.isPopup !== undefined && cellEditor.isPopup());\n if (cellEditorInPopup) {\n this.addPopupCellEditor(params, position);\n }\n else {\n this.addInCellEditor();\n }\n this.refreshEditStyles(true, cellEditorInPopup);\n if (cellEditor.afterGuiAttached) {\n cellEditor.afterGuiAttached();\n }\n }\n refreshEditStyles(editing, isPopup) {\n var _a;\n this.addOrRemoveCssClass('ag-cell-inline-editing', editing && !isPopup);\n this.addOrRemoveCssClass('ag-cell-popup-editing', editing && !!isPopup);\n this.addOrRemoveCssClass('ag-cell-not-inline-editing', !editing || !!isPopup);\n (_a = this.rowCtrl) === null || _a === void 0 ? void 0 : _a.setInlineEditingCss(editing);\n }\n addInCellEditor() {\n const eGui = this.getGui();\n // if focus is inside the cell, we move focus to the cell itself\n // before removing it's contents, otherwise errors could be thrown.\n const eDocument = this.beans.gridOptionsService.getDocument();\n if (eGui.contains(eDocument.activeElement)) {\n eGui.focus();\n }\n this.destroyRenderer();\n this.refreshWrapper(true);\n this.clearParentOfValue();\n if (this.cellEditorGui) {\n const eParent = this.getParentOfValue();\n eParent.appendChild(this.cellEditorGui);\n }\n }\n addPopupCellEditor(params, position) {\n if (this.beans.gridOptionsService.get('editType') === 'fullRow') {\n console.warn('AG Grid: popup cellEditor does not work with fullRowEdit - you cannot use them both ' +\n '- either turn off fullRowEdit, or stop using popup editors.');\n }\n const cellEditor = this.cellEditor;\n // if a popup, then we wrap in a popup editor and return the popup\n this.cellEditorPopupWrapper = this.beans.context.createBean(new PopupEditorWrapper(params));\n const ePopupGui = this.cellEditorPopupWrapper.getGui();\n if (this.cellEditorGui) {\n ePopupGui.appendChild(this.cellEditorGui);\n }\n const popupService = this.beans.popupService;\n const useModelPopup = this.beans.gridOptionsService.is('stopEditingWhenCellsLoseFocus');\n // see if position provided by colDef, if not then check old way of method on cellComp\n const positionToUse = position != null\n ? position\n : cellEditor.getPopupPosition\n ? cellEditor.getPopupPosition()\n : 'over';\n const isRtl = this.beans.gridOptionsService.is('enableRtl');\n const positionParams = {\n ePopup: ePopupGui,\n column: this.column,\n rowNode: this.rowNode,\n type: 'popupCellEditor',\n eventSource: this.getGui(),\n position: positionToUse,\n alignSide: isRtl ? 'right' : 'left',\n keepWithinBounds: true\n };\n const positionCallback = popupService.positionPopupByComponent.bind(popupService, positionParams);\n const translate = this.beans.localeService.getLocaleTextFunc();\n const addPopupRes = popupService.addPopup({\n modal: useModelPopup,\n eChild: ePopupGui,\n closeOnEsc: true,\n closedCallback: () => { this.cellCtrl.onPopupEditorClosed(); },\n anchorToElement: this.getGui(),\n positionCallback,\n ariaLabel: translate('ariaLabelCellEditor', 'Cell Editor')\n });\n if (addPopupRes) {\n this.hideEditorPopup = addPopupRes.hideFunc;\n }\n }\n detach() {\n this.eRow.removeChild(this.getGui());\n }\n // if the row is also getting destroyed, then we don't need to remove from dom,\n // as the row will also get removed, so no need to take out the cells from the row\n // if the row is going (removing is an expensive operation, so only need to remove\n // the top part)\n //\n // note - this is NOT called by context, as we don't wire / unwire the CellComp for performance reasons.\n destroy() {\n this.cellCtrl.stopEditing();\n this.destroyEditorAndRenderer();\n this.removeControls();\n super.destroy();\n }\n clearParentOfValue() {\n const eGui = this.getGui();\n // if focus is inside the cell, we move focus to the cell itself\n // before removing it's contents, otherwise errors could be thrown.\n const eDocument = this.beans.gridOptionsService.getDocument();\n if (eGui.contains(eDocument.activeElement) && browserSupportsPreventScroll()) {\n eGui.focus({ preventScroll: true });\n }\n clearElement(this.getParentOfValue());\n }\n}\n","import { Component } from \"../../widgets/component.mjs\";\nimport { addStylesToElement, setDomChildOrder } from \"../../utils/dom.mjs\";\nimport { CellComp } from \"../cell/cellComp.mjs\";\nimport { getAllValuesInObject } from \"../../utils/object.mjs\";\nimport { setAriaRole } from \"../../utils/aria.mjs\";\nexport class RowComp extends Component {\n constructor(ctrl, beans, containerType) {\n super();\n this.cellComps = {};\n this.beans = beans;\n this.rowCtrl = ctrl;\n this.setTemplate(/* html */ `
`);\n const eGui = this.getGui();\n const style = eGui.style;\n this.domOrder = this.rowCtrl.getDomOrder();\n setAriaRole(eGui, 'row');\n const tabIndex = this.rowCtrl.getTabIndex();\n if (tabIndex != null) {\n eGui.setAttribute('tabindex', tabIndex.toString());\n }\n const compProxy = {\n setDomOrder: domOrder => this.domOrder = domOrder,\n setCellCtrls: cellCtrls => this.setCellCtrls(cellCtrls),\n showFullWidth: compDetails => this.showFullWidth(compDetails),\n getFullWidthCellRenderer: () => this.getFullWidthCellRenderer(),\n addOrRemoveCssClass: (name, on) => this.addOrRemoveCssClass(name, on),\n setUserStyles: (styles) => addStylesToElement(eGui, styles),\n setTop: top => style.top = top,\n setTransform: transform => style.transform = transform,\n setRowIndex: rowIndex => eGui.setAttribute('row-index', rowIndex),\n setRowId: (rowId) => eGui.setAttribute('row-id', rowId),\n setRowBusinessKey: businessKey => eGui.setAttribute('row-business-key', businessKey),\n };\n ctrl.setComp(compProxy, this.getGui(), containerType);\n this.addDestroyFunc(() => {\n ctrl.unsetComp(containerType);\n });\n }\n getInitialStyle(containerType) {\n const transform = this.rowCtrl.getInitialTransform(containerType);\n const top = this.rowCtrl.getInitialRowTop(containerType);\n return transform ? `transform: ${transform}` : `top: ${top}`;\n }\n showFullWidth(compDetails) {\n const callback = (cellRenderer) => {\n if (this.isAlive()) {\n const eGui = cellRenderer.getGui();\n this.getGui().appendChild(eGui);\n this.rowCtrl.setupDetailRowAutoHeight(eGui);\n this.setFullWidthRowComp(cellRenderer);\n }\n else {\n this.beans.context.destroyBean(cellRenderer);\n }\n };\n // if not in cache, create new one\n const res = compDetails.newAgStackInstance();\n if (!res) {\n return;\n }\n res.then(callback);\n }\n setCellCtrls(cellCtrls) {\n const cellsToRemove = Object.assign({}, this.cellComps);\n cellCtrls.forEach(cellCtrl => {\n const key = cellCtrl.getInstanceId();\n const existingCellComp = this.cellComps[key];\n if (existingCellComp == null) {\n this.newCellComp(cellCtrl);\n }\n else {\n cellsToRemove[key] = null;\n }\n });\n const cellCompsToRemove = getAllValuesInObject(cellsToRemove)\n .filter(cellComp => cellComp != null);\n this.destroyCells(cellCompsToRemove);\n this.ensureDomOrder(cellCtrls);\n }\n ensureDomOrder(cellCtrls) {\n if (!this.domOrder) {\n return;\n }\n const elementsInOrder = [];\n cellCtrls.forEach(cellCtrl => {\n const cellComp = this.cellComps[cellCtrl.getInstanceId()];\n if (cellComp) {\n elementsInOrder.push(cellComp.getGui());\n }\n });\n setDomChildOrder(this.getGui(), elementsInOrder);\n }\n newCellComp(cellCtrl) {\n const cellComp = new CellComp(this.beans, cellCtrl, this.rowCtrl.isPrintLayout(), this.getGui(), this.rowCtrl.isEditing());\n this.cellComps[cellCtrl.getInstanceId()] = cellComp;\n this.getGui().appendChild(cellComp.getGui());\n }\n destroy() {\n super.destroy();\n this.destroyAllCells();\n }\n destroyAllCells() {\n const cellsToDestroy = getAllValuesInObject(this.cellComps).filter(cp => cp != null);\n this.destroyCells(cellsToDestroy);\n }\n setFullWidthRowComp(fullWidthRowComponent) {\n if (this.fullWidthCellRenderer) {\n console.error('AG Grid - should not be setting fullWidthRowComponent twice');\n }\n this.fullWidthCellRenderer = fullWidthRowComponent;\n this.addDestroyFunc(() => {\n this.fullWidthCellRenderer = this.beans.context.destroyBean(this.fullWidthCellRenderer);\n });\n }\n getFullWidthCellRenderer() {\n return this.fullWidthCellRenderer;\n }\n destroyCells(cellComps) {\n cellComps.forEach(cellComp => {\n // could be old reference, ie removed cell\n if (!cellComp) {\n return;\n }\n // check cellComp belongs in this container\n const instanceId = cellComp.getCtrl().getInstanceId();\n if (this.cellComps[instanceId] !== cellComp) {\n return;\n }\n cellComp.detach();\n cellComp.destroy();\n this.cellComps[instanceId] = null;\n });\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from \"../../widgets/component.mjs\";\nimport { RefSelector } from \"../../widgets/componentAnnotations.mjs\";\nimport { Autowired, PostConstruct, PreDestroy } from \"../../context/context.mjs\";\nimport { getRowContainerTypeForName, RowContainerCtrl, RowContainerName } from \"./rowContainerCtrl.mjs\";\nimport { ensureDomOrder, insertWithDomOrder } from \"../../utils/dom.mjs\";\nimport { RowComp } from \"../../rendering/row/rowComp.mjs\";\nimport { getAllValuesInObject } from \"../../utils/object.mjs\";\nimport { setAriaRole } from \"../../utils/aria.mjs\";\nfunction templateFactory() {\n const name = Component.elementGettingCreated.getAttribute('name');\n const cssClasses = RowContainerCtrl.getRowContainerCssClasses(name);\n let res;\n const template1 = name === RowContainerName.CENTER;\n const template2 = name === RowContainerName.TOP_CENTER\n || name === RowContainerName.STICKY_TOP_CENTER\n || name === RowContainerName.BOTTOM_CENTER;\n if (template1) {\n res = /* html */\n `
\n
\n
\n
\n
`;\n }\n else if (template2) {\n res = /* html */\n `
\n
\n
`;\n }\n else {\n res = /* html */\n `
`;\n }\n return res;\n}\nexport class RowContainerComp extends Component {\n constructor() {\n super(templateFactory());\n this.rowComps = {};\n this.name = Component.elementGettingCreated.getAttribute('name');\n this.type = getRowContainerTypeForName(this.name);\n }\n postConstruct() {\n const compProxy = {\n setViewportHeight: height => this.eViewport.style.height = height,\n setRowCtrls: rowCtrls => this.setRowCtrls(rowCtrls),\n setDomOrder: domOrder => {\n this.domOrder = domOrder;\n },\n setContainerWidth: width => this.eContainer.style.width = width\n };\n const ctrl = this.createManagedBean(new RowContainerCtrl(this.name));\n ctrl.setComp(compProxy, this.eContainer, this.eViewport, this.eWrapper);\n }\n preDestroy() {\n // destroys all row comps\n this.setRowCtrls([]);\n }\n setRowCtrls(rowCtrls) {\n const oldRows = Object.assign({}, this.rowComps);\n this.rowComps = {};\n this.lastPlacedElement = null;\n const processRow = (rowCon) => {\n const instanceId = rowCon.getInstanceId();\n const existingRowComp = oldRows[instanceId];\n if (existingRowComp) {\n this.rowComps[instanceId] = existingRowComp;\n delete oldRows[instanceId];\n this.ensureDomOrder(existingRowComp.getGui());\n }\n else {\n // don't create new row comps for rows which are not displayed. still want the existing components\n // as they may be animating out.\n if (!rowCon.getRowNode().displayed) {\n return;\n }\n const rowComp = new RowComp(rowCon, this.beans, this.type);\n this.rowComps[instanceId] = rowComp;\n this.appendRow(rowComp.getGui());\n }\n };\n rowCtrls.forEach(processRow);\n getAllValuesInObject(oldRows).forEach(oldRowComp => {\n this.eContainer.removeChild(oldRowComp.getGui());\n oldRowComp.destroy();\n });\n setAriaRole(this.eContainer, rowCtrls.length ? \"rowgroup\" : \"presentation\");\n }\n appendRow(element) {\n if (this.domOrder) {\n insertWithDomOrder(this.eContainer, element, this.lastPlacedElement);\n }\n else {\n this.eContainer.appendChild(element);\n }\n this.lastPlacedElement = element;\n }\n ensureDomOrder(eRow) {\n if (this.domOrder) {\n ensureDomOrder(this.eContainer, eRow, this.lastPlacedElement);\n this.lastPlacedElement = eRow;\n }\n }\n}\n__decorate([\n Autowired('beans')\n], RowContainerComp.prototype, \"beans\", void 0);\n__decorate([\n RefSelector('eViewport')\n], RowContainerComp.prototype, \"eViewport\", void 0);\n__decorate([\n RefSelector('eContainer')\n], RowContainerComp.prototype, \"eContainer\", void 0);\n__decorate([\n RefSelector('eWrapper')\n], RowContainerComp.prototype, \"eWrapper\", void 0);\n__decorate([\n PostConstruct\n], RowContainerComp.prototype, \"postConstruct\", null);\n__decorate([\n PreDestroy\n], RowContainerComp.prototype, \"preDestroy\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { DragAndDropService } from \"../../dragAndDrop/dragAndDropService.mjs\";\nimport { Autowired } from \"../../context/context.mjs\";\nexport class BodyDropPivotTarget {\n constructor(pinned) {\n this.columnsToAggregate = [];\n this.columnsToGroup = [];\n this.columnsToPivot = [];\n this.pinned = pinned;\n }\n /** Callback for when drag enters */\n onDragEnter(draggingEvent) {\n this.clearColumnsList();\n // in pivot mode, we don't accept any drops if functions are read only\n if (this.gridOptionsService.is('functionsReadOnly')) {\n return;\n }\n const dragColumns = draggingEvent.dragItem.columns;\n if (!dragColumns) {\n return;\n }\n dragColumns.forEach(column => {\n // we don't allow adding secondary columns\n if (!column.isPrimary()) {\n return;\n }\n if (column.isAnyFunctionActive()) {\n return;\n }\n if (column.isAllowValue()) {\n this.columnsToAggregate.push(column);\n }\n else if (column.isAllowRowGroup()) {\n this.columnsToGroup.push(column);\n }\n else if (column.isAllowPivot()) {\n this.columnsToPivot.push(column);\n }\n });\n }\n getIconName() {\n const totalColumns = this.columnsToAggregate.length + this.columnsToGroup.length + this.columnsToPivot.length;\n if (totalColumns > 0) {\n return this.pinned ? DragAndDropService.ICON_PINNED : DragAndDropService.ICON_MOVE;\n }\n return null;\n }\n /** Callback for when drag leaves */\n onDragLeave(draggingEvent) {\n // if we are taking columns out of the center, then we remove them from the report\n this.clearColumnsList();\n }\n clearColumnsList() {\n this.columnsToAggregate.length = 0;\n this.columnsToGroup.length = 0;\n this.columnsToPivot.length = 0;\n }\n /** Callback for when dragging */\n onDragging(draggingEvent) {\n }\n /** Callback for when drag stops */\n onDragStop(draggingEvent) {\n if (this.columnsToAggregate.length > 0) {\n this.columnModel.addValueColumns(this.columnsToAggregate, \"toolPanelDragAndDrop\");\n }\n if (this.columnsToGroup.length > 0) {\n this.columnModel.addRowGroupColumns(this.columnsToGroup, \"toolPanelDragAndDrop\");\n }\n if (this.columnsToPivot.length > 0) {\n this.columnModel.addPivotColumns(this.columnsToPivot, \"toolPanelDragAndDrop\");\n }\n }\n}\n__decorate([\n Autowired('columnModel')\n], BodyDropPivotTarget.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('gridOptionsService')\n], BodyDropPivotTarget.prototype, \"gridOptionsService\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from \"../../context/context.mjs\";\nimport { DragAndDropService, DragSourceType, HorizontalDirection } from \"../../dragAndDrop/dragAndDropService.mjs\";\nimport { missing, exists } from \"../../utils/generic.mjs\";\nimport { sortNumerically, last, includes } from \"../../utils/array.mjs\";\nimport { _ } from \"../../utils/index.mjs\";\nexport class MoveColumnFeature {\n constructor(pinned, eContainer) {\n this.needToMoveLeft = false;\n this.needToMoveRight = false;\n this.lastMovedInfo = null;\n this.pinned = pinned;\n this.eContainer = eContainer;\n this.centerContainer = !exists(pinned);\n }\n init() {\n this.ctrlsService.whenReady(() => {\n this.gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n });\n }\n getIconName() {\n return this.pinned ? DragAndDropService.ICON_PINNED : DragAndDropService.ICON_MOVE;\n }\n onDragEnter(draggingEvent) {\n // we do dummy drag, so make sure column appears in the right location when first placed\n const columns = draggingEvent.dragItem.columns;\n const dragCameFromToolPanel = draggingEvent.dragSource.type === DragSourceType.ToolPanel;\n if (dragCameFromToolPanel) {\n // the if statement doesn't work if drag leaves grid, then enters again\n this.setColumnsVisible(columns, true, \"uiColumnDragged\");\n }\n else {\n // restore previous state of visible columns upon re-entering. this means if the user drags\n // a group out, and then drags the group back in, only columns that were originally visible\n // will be visible again. otherwise a group with three columns (but only two visible) could\n // be dragged out, then when it's dragged in again, all three are visible. this stops that.\n const visibleState = draggingEvent.dragItem.visibleState;\n const visibleColumns = (columns || []).filter(column => visibleState[column.getId()]);\n this.setColumnsVisible(visibleColumns, true, \"uiColumnDragged\");\n }\n this.setColumnsPinned(columns, this.pinned, \"uiColumnDragged\");\n this.onDragging(draggingEvent, true, true);\n }\n onDragLeave() {\n this.ensureIntervalCleared();\n this.lastMovedInfo = null;\n }\n setColumnsVisible(columns, visible, source = \"api\") {\n if (columns) {\n const allowedCols = columns.filter(c => !c.getColDef().lockVisible);\n this.columnModel.setColumnsVisible(allowedCols, visible, source);\n }\n }\n setColumnsPinned(columns, pinned, source = \"api\") {\n if (columns) {\n const allowedCols = columns.filter(c => !c.getColDef().lockPinned);\n this.columnModel.setColumnsPinned(allowedCols, pinned, source);\n }\n }\n onDragStop() {\n this.onDragging(this.lastDraggingEvent, false, true, true);\n this.ensureIntervalCleared();\n this.lastMovedInfo = null;\n }\n normaliseX(x) {\n // flip the coordinate if doing RTL\n if (this.gridOptionsService.is('enableRtl')) {\n const clientWidth = this.eContainer.clientWidth;\n x = clientWidth - x;\n }\n // adjust for scroll only if centre container (the pinned containers don't scroll)\n if (this.centerContainer) {\n x += this.ctrlsService.getCenterRowContainerCtrl().getCenterViewportScrollLeft();\n }\n return x;\n }\n checkCenterForScrolling(xAdjustedForScroll) {\n if (this.centerContainer) {\n // scroll if the mouse has gone outside the grid (or just outside the scrollable part if pinning)\n // putting in 50 buffer, so even if user gets to edge of grid, a scroll will happen\n const firstVisiblePixel = this.ctrlsService.getCenterRowContainerCtrl().getCenterViewportScrollLeft();\n const lastVisiblePixel = firstVisiblePixel + this.ctrlsService.getCenterRowContainerCtrl().getCenterWidth();\n if (this.gridOptionsService.is('enableRtl')) {\n this.needToMoveRight = xAdjustedForScroll < (firstVisiblePixel + 50);\n this.needToMoveLeft = xAdjustedForScroll > (lastVisiblePixel - 50);\n }\n else {\n this.needToMoveLeft = xAdjustedForScroll < (firstVisiblePixel + 50);\n this.needToMoveRight = xAdjustedForScroll > (lastVisiblePixel - 50);\n }\n if (this.needToMoveLeft || this.needToMoveRight) {\n this.ensureIntervalStarted();\n }\n else {\n this.ensureIntervalCleared();\n }\n }\n }\n onDragging(draggingEvent = this.lastDraggingEvent, fromEnter = false, fakeEvent = false, finished = false) {\n var _a;\n if (finished) {\n if (this.lastMovedInfo) {\n const { columns, toIndex } = this.lastMovedInfo;\n this.moveColumns(columns, toIndex, 'uiColumnMoved', true);\n }\n return;\n }\n this.lastDraggingEvent = draggingEvent;\n // if moving up or down (ie not left or right) then do nothing\n if (missing(draggingEvent.hDirection)) {\n return;\n }\n const mouseX = this.normaliseX(draggingEvent.x);\n // if the user is dragging into the panel, ie coming from the side panel into the main grid,\n // we don't want to scroll the grid this time, it would appear like the table is jumping\n // each time a column is dragged in.\n if (!fromEnter) {\n this.checkCenterForScrolling(mouseX);\n }\n const hDirection = this.normaliseDirection(draggingEvent.hDirection);\n const dragSourceType = draggingEvent.dragSource.type;\n const allMovingColumns = ((_a = draggingEvent.dragSource.getDragItem().columns) === null || _a === void 0 ? void 0 : _a.filter(col => {\n if (col.getColDef().lockPinned) {\n // if locked return true only if both col and container are same pin type.\n // double equals (==) here on purpose so that null==undefined is true (for not pinned options)\n return col.getPinned() == this.pinned;\n }\n // if not pin locked, then always allowed to be in this container\n return true;\n })) || [];\n this.attemptMoveColumns({ dragSourceType, allMovingColumns, hDirection, mouseX, fromEnter, fakeEvent });\n }\n normaliseDirection(hDirection) {\n if (this.gridOptionsService.is('enableRtl')) {\n switch (hDirection) {\n case HorizontalDirection.Left: return HorizontalDirection.Right;\n case HorizontalDirection.Right: return HorizontalDirection.Left;\n default: console.error(`AG Grid: Unknown direction ${hDirection}`);\n }\n }\n else {\n return hDirection;\n }\n }\n attemptMoveColumns(params) {\n const { dragSourceType, hDirection, mouseX, fromEnter, fakeEvent } = params;\n const draggingLeft = hDirection === HorizontalDirection.Left;\n const draggingRight = hDirection === HorizontalDirection.Right;\n let { allMovingColumns } = params;\n if (dragSourceType === DragSourceType.HeaderCell) {\n // If the columns we're dragging are the only visible columns of their group, move the hidden ones too\n let newCols = [];\n allMovingColumns.forEach((col) => {\n var _a;\n let movingGroup = null;\n let parent = col.getParent();\n while (parent != null && parent.getDisplayedLeafColumns().length === 1) {\n movingGroup = parent;\n parent = parent.getParent();\n }\n if (movingGroup != null) {\n const isMarryChildren = !!((_a = movingGroup.getColGroupDef()) === null || _a === void 0 ? void 0 : _a.marryChildren);\n const columnsToMove = isMarryChildren\n // when marry children is true, we also have to move hidden\n // columns within the group, so grab them from the `providedColumnGroup`\n ? movingGroup.getProvidedColumnGroup().getLeafColumns()\n : movingGroup.getLeafColumns();\n columnsToMove.forEach((newCol) => {\n if (!newCols.includes(newCol)) {\n newCols.push(newCol);\n }\n });\n }\n else if (!newCols.includes(col)) {\n newCols.push(col);\n }\n });\n allMovingColumns = newCols;\n }\n // it is important to sort the moving columns as they are in grid columns, as the list of moving columns\n // could themselves be part of 'married children' groups, which means we need to maintain the order within\n // the moving list.\n const allMovingColumnsOrdered = allMovingColumns.slice();\n this.columnModel.sortColumnsLikeGridColumns(allMovingColumnsOrdered);\n const validMoves = this.calculateValidMoves(allMovingColumnsOrdered, draggingRight, mouseX);\n // if cols are not adjacent, then this returns null. when moving, we constrain the direction of the move\n // (ie left or right) to the mouse direction. however\n const oldIndex = this.calculateOldIndex(allMovingColumnsOrdered);\n if (validMoves.length === 0) {\n return;\n }\n const firstValidMove = validMoves[0];\n // the two check below stop an error when the user grabs a group my a middle column, then\n // it is possible the mouse pointer is to the right of a column while been dragged left.\n // so we need to make sure that the mouse pointer is actually left of the left most column\n // if moving left, and right of the right most column if moving right\n // we check 'fromEnter' below so we move the column to the new spot if the mouse is coming from\n // outside the grid, eg if the column is moving from side panel, mouse is moving left, then we should\n // place the column to the RHS even if the mouse is moving left and the column is already on\n // the LHS. otherwise we stick to the rule described above.\n let constrainDirection = oldIndex !== null && !fromEnter;\n // don't consider 'fromEnter' when dragging header cells, otherwise group can jump to opposite direction of drag\n if (dragSourceType == DragSourceType.HeaderCell) {\n constrainDirection = oldIndex !== null;\n }\n // if the event was faked by a change in column pin state, then the original location of the column\n // is not reliable for dictating where the column may now be placed.\n if (constrainDirection && !fakeEvent) {\n // only allow left drag if this column is moving left\n if (draggingLeft && firstValidMove >= oldIndex) {\n return;\n }\n // only allow right drag if this column is moving right\n if (draggingRight && firstValidMove <= oldIndex) {\n return;\n }\n }\n // From when we find a move that passes all the rules\n // Remember what that move would look like in terms of displayed cols\n // keep going with further moves until we find a different result in displayed output\n // In this way potentialMoves contains all potential moves over 'hidden' columns\n const displayedCols = this.columnModel.getAllDisplayedColumns();\n let potentialMoves = [];\n let targetOrder = null;\n for (let i = 0; i < validMoves.length; i++) {\n const move = validMoves[i];\n const order = this.columnModel.getProposedColumnOrder(allMovingColumnsOrdered, move);\n if (!this.columnModel.doesOrderPassRules(order)) {\n continue;\n }\n const displayedOrder = order.filter((col) => displayedCols.includes(col));\n if (targetOrder === null) {\n targetOrder = displayedOrder;\n }\n else if (!_.areEqual(displayedOrder, targetOrder)) {\n break; // Stop looking for potential moves if the displayed result changes from the target\n }\n const fragCount = this.groupFragCount(order);\n potentialMoves.push({ move, fragCount });\n }\n if (potentialMoves.length === 0) {\n return;\n }\n // The best move is the move with least group fragmentation\n potentialMoves.sort((a, b) => a.fragCount - b.fragCount);\n this.moveColumns(allMovingColumns, potentialMoves[0].move, 'uiColumnMoved', false);\n }\n // returns the index of the first column in the list ONLY if the cols are all beside\n // each other. if the cols are not beside each other, then returns null\n calculateOldIndex(movingCols) {\n const gridCols = this.columnModel.getAllGridColumns();\n const indexes = sortNumerically(movingCols.map(col => gridCols.indexOf(col)));\n const firstIndex = indexes[0];\n const lastIndex = last(indexes);\n const spread = lastIndex - firstIndex;\n const gapsExist = spread !== indexes.length - 1;\n return gapsExist ? null : firstIndex;\n }\n moveColumns(columns, toIndex, source, finished) {\n this.columnModel.moveColumns(columns, toIndex, source, finished);\n this.lastMovedInfo = finished ? null : { columns, toIndex };\n }\n // A measure of how fragmented in terms of groups an order of columns is\n groupFragCount(columns) {\n function parents(col) {\n let result = [];\n let parent = col.getOriginalParent();\n while (parent != null) {\n result.push(parent);\n parent = parent.getOriginalParent();\n }\n return result;\n }\n let count = 0;\n for (let i = 0; i < columns.length - 1; i++) {\n let a = parents(columns[i]);\n let b = parents(columns[i + 1]);\n // iterate over the longest one\n [a, b] = a.length > b.length ? [a, b] : [b, a];\n a.forEach((parent) => {\n if (b.indexOf(parent) === -1) {\n count++; // More fragmented if other column doesn't share the parent\n }\n });\n }\n return count;\n }\n calculateValidMoves(movingCols, draggingRight, mouseX) {\n const isMoveBlocked = this.gridOptionsService.is('suppressMovableColumns') || movingCols.some(col => col.getColDef().suppressMovable);\n if (isMoveBlocked) {\n return [];\n }\n // this is the list of cols on the screen, so it's these we use when comparing the x mouse position\n const allDisplayedCols = this.columnModel.getDisplayedColumns(this.pinned);\n // but this list is the list of all cols, when we move a col it's the index within this list that gets used,\n // so the result we return has to be and index location for this list\n const allGridCols = this.columnModel.getAllGridColumns();\n const movingDisplayedCols = allDisplayedCols.filter(col => includes(movingCols, col));\n const otherDisplayedCols = allDisplayedCols.filter(col => !includes(movingCols, col));\n const otherGridCols = allGridCols.filter(col => !includes(movingCols, col));\n // work out how many DISPLAYED columns fit before the 'x' position. this gives us the displayIndex.\n // for example, if cols are a,b,c,d and we find a,b fit before 'x', then we want to place the moving\n // col between b and c (so that it is under the mouse position).\n let displayIndex = 0;\n let availableWidth = mouseX;\n // if we are dragging right, then the columns will be to the left of the mouse, so we also want to\n // include the width of the moving columns\n if (draggingRight) {\n let widthOfMovingDisplayedCols = 0;\n movingDisplayedCols.forEach(col => widthOfMovingDisplayedCols += col.getActualWidth());\n availableWidth -= widthOfMovingDisplayedCols;\n }\n if (availableWidth > 0) {\n // now count how many of the displayed columns will fit to the left\n for (let i = 0; i < otherDisplayedCols.length; i++) {\n const col = otherDisplayedCols[i];\n availableWidth -= col.getActualWidth();\n if (availableWidth < 0) {\n break;\n }\n displayIndex++;\n }\n // trial and error, if going right, we adjust by one, i didn't manage to quantify why, but it works\n if (draggingRight) {\n displayIndex++;\n }\n }\n // the display index is with respect to all the showing columns, however when we move, it's with\n // respect to all grid columns, so we need to translate from display index to grid index\n let firstValidMove;\n if (displayIndex > 0) {\n const leftColumn = otherDisplayedCols[displayIndex - 1];\n firstValidMove = otherGridCols.indexOf(leftColumn) + 1;\n }\n else {\n firstValidMove = otherGridCols.indexOf(otherDisplayedCols[0]);\n if (firstValidMove === -1) {\n firstValidMove = 0;\n }\n }\n const validMoves = [firstValidMove];\n const numberComparator = (a, b) => a - b;\n // add in other valid moves due to hidden columns and married children. for example, a particular\n // move might break a group that has married children (so move isn't valid), however there could\n // be hidden columns (not displayed) that we could jump over to make the move valid. because\n // they are hidden, user doesn't see any different, however it allows moves that would otherwise\n // not work. for example imagine a group with 9 columns and all columns are hidden except the\n // middle one (so 4 hidden to left, 4 hidden to right), then when moving 'firstValidMove' will\n // be relative to the not-shown column, however we need to consider the move jumping over all the\n // hidden children. if we didn't do this, then if the group just described was at the end (RHS) of the\n // grid, there would be no way to put a column after it (as the grid would only consider beside the\n // visible column, which would fail valid move rules).\n if (draggingRight) {\n // if dragging right, then we add all the additional moves to the right. so in other words\n // if the next move is not valid, find the next move to the right that is valid.\n let pointer = firstValidMove + 1;\n const lastIndex = allGridCols.length - 1;\n while (pointer <= lastIndex) {\n validMoves.push(pointer);\n pointer++;\n }\n // adding columns here means the order is now messed up\n validMoves.sort(numberComparator);\n }\n else {\n // if dragging left we do the reverse of dragging right, we add in all the valid moves to the\n // left. however we also have to consider moves to the right for all hidden columns first.\n // (this logic is hard to reason with, it was worked out with trial and error,\n // more observation rather than science).\n // add moves to the right\n let pointer = firstValidMove;\n const lastIndex = allGridCols.length - 1;\n let displacedCol = allGridCols[pointer];\n while (pointer <= lastIndex && this.isColumnHidden(allDisplayedCols, displacedCol)) {\n pointer++;\n validMoves.push(pointer);\n displacedCol = allGridCols[pointer];\n }\n // add moves to the left\n pointer = firstValidMove - 1;\n const firstDisplayIndex = 0;\n while (pointer >= firstDisplayIndex) {\n validMoves.push(pointer);\n pointer--;\n }\n // adding columns here means the order is now messed up\n validMoves.sort(numberComparator).reverse();\n }\n return validMoves;\n }\n // isHidden takes into account visible=false and group=closed, ie it is not displayed\n isColumnHidden(displayedColumns, col) {\n return displayedColumns.indexOf(col) < 0;\n }\n ensureIntervalStarted() {\n if (!this.movingIntervalId) {\n this.intervalCount = 0;\n this.failedMoveAttempts = 0;\n this.movingIntervalId = window.setInterval(this.moveInterval.bind(this), 100);\n if (this.needToMoveLeft) {\n this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_LEFT, true);\n }\n else {\n this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_RIGHT, true);\n }\n }\n }\n ensureIntervalCleared() {\n if (this.movingIntervalId) {\n window.clearInterval(this.movingIntervalId);\n this.movingIntervalId = null;\n this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_MOVE);\n }\n }\n moveInterval() {\n // the amounts we move get bigger at each interval, so the speed accelerates, starting a bit slow\n // and getting faster. this is to give smoother user experience. we max at 100px to limit the speed.\n let pixelsToMove;\n this.intervalCount++;\n pixelsToMove = 10 + (this.intervalCount * 5);\n if (pixelsToMove > 100) {\n pixelsToMove = 100;\n }\n let pixelsMoved = null;\n const scrollFeature = this.gridBodyCon.getScrollFeature();\n if (this.needToMoveLeft) {\n pixelsMoved = scrollFeature.scrollHorizontally(-pixelsToMove);\n }\n else if (this.needToMoveRight) {\n pixelsMoved = scrollFeature.scrollHorizontally(pixelsToMove);\n }\n if (pixelsMoved !== 0) {\n this.onDragging(this.lastDraggingEvent);\n this.failedMoveAttempts = 0;\n }\n else {\n // we count the failed move attempts. if we fail to move 7 times, then we pin the column.\n // this is how we achieve pining by dragging the column to the edge of the grid.\n this.failedMoveAttempts++;\n const columns = this.lastDraggingEvent.dragItem.columns;\n const columnsThatCanPin = columns.filter(c => !c.getColDef().lockPinned);\n if (columnsThatCanPin.length > 0) {\n this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_PINNED);\n if (this.failedMoveAttempts > 7) {\n const pinType = this.needToMoveLeft ? 'left' : 'right';\n this.setColumnsPinned(columnsThatCanPin, pinType, \"uiColumnDragged\");\n this.dragAndDropService.nudge();\n }\n }\n }\n }\n}\n__decorate([\n Autowired('columnModel')\n], MoveColumnFeature.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('dragAndDropService')\n], MoveColumnFeature.prototype, \"dragAndDropService\", void 0);\n__decorate([\n Autowired('gridOptionsService')\n], MoveColumnFeature.prototype, \"gridOptionsService\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], MoveColumnFeature.prototype, \"ctrlsService\", void 0);\n__decorate([\n PostConstruct\n], MoveColumnFeature.prototype, \"init\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { DragSourceType } from \"../../dragAndDrop/dragAndDropService.mjs\";\nimport { Autowired, PostConstruct } from \"../../context/context.mjs\";\nimport { MoveColumnFeature } from \"./moveColumnFeature.mjs\";\nimport { BodyDropPivotTarget } from \"./bodyDropPivotTarget.mjs\";\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nexport class BodyDropTarget extends BeanStub {\n constructor(pinned, eContainer) {\n super();\n this.pinned = pinned;\n this.eContainer = eContainer;\n }\n postConstruct() {\n this.ctrlsService.whenReady(p => {\n switch (this.pinned) {\n case 'left':\n this.eSecondaryContainers = [\n [p.gridBodyCtrl.getBodyViewportElement(), p.leftRowContainerCtrl.getContainerElement()],\n [p.bottomLeftRowContainerCtrl.getContainerElement()],\n [p.topLeftRowContainerCtrl.getContainerElement()]\n ];\n break;\n case 'right':\n this.eSecondaryContainers = [\n [p.gridBodyCtrl.getBodyViewportElement(), p.rightRowContainerCtrl.getContainerElement()],\n [p.bottomRightRowContainerCtrl.getContainerElement()],\n [p.topRightRowContainerCtrl.getContainerElement()]\n ];\n break;\n default:\n this.eSecondaryContainers = [\n [p.gridBodyCtrl.getBodyViewportElement(), p.centerRowContainerCtrl.getViewportElement()],\n [p.bottomCenterRowContainerCtrl.getViewportElement()],\n [p.topCenterRowContainerCtrl.getViewportElement()]\n ];\n break;\n }\n });\n }\n isInterestedIn(type) {\n return type === DragSourceType.HeaderCell ||\n (type === DragSourceType.ToolPanel && this.gridOptionsService.is('allowDragFromColumnsToolPanel'));\n }\n getSecondaryContainers() {\n return this.eSecondaryContainers;\n }\n getContainer() {\n return this.eContainer;\n }\n init() {\n this.moveColumnFeature = this.createManagedBean(new MoveColumnFeature(this.pinned, this.eContainer));\n this.bodyDropPivotTarget = this.createManagedBean(new BodyDropPivotTarget(this.pinned));\n this.dragAndDropService.addDropTarget(this);\n }\n getIconName() {\n return this.currentDropListener.getIconName();\n }\n // we want to use the bodyPivotTarget if the user is dragging columns in from the toolPanel\n // and we are in pivot mode, as it has to logic to set pivot/value/group on the columns when\n // dropped into the grid's body.\n isDropColumnInPivotMode(draggingEvent) {\n // in pivot mode, then if moving a column (ie didn't come from toolpanel) then it's\n // a standard column move, however if it came from the toolpanel, then we are introducing\n // dimensions or values to the grid\n return this.columnModel.isPivotMode() && draggingEvent.dragSource.type === DragSourceType.ToolPanel;\n }\n onDragEnter(draggingEvent) {\n // we pick the drop listener depending on whether we are in pivot mode are not. if we are\n // in pivot mode, then dropping cols changes the row group, pivot, value stats. otherwise\n // we change visibility state and position.\n this.currentDropListener = this.isDropColumnInPivotMode(draggingEvent) ? this.bodyDropPivotTarget : this.moveColumnFeature;\n this.currentDropListener.onDragEnter(draggingEvent);\n }\n onDragLeave(params) {\n this.currentDropListener.onDragLeave(params);\n }\n onDragging(params) {\n this.currentDropListener.onDragging(params);\n }\n onDragStop(params) {\n this.currentDropListener.onDragStop(params);\n }\n}\n__decorate([\n Autowired('dragAndDropService')\n], BodyDropTarget.prototype, \"dragAndDropService\", void 0);\n__decorate([\n Autowired('columnModel')\n], BodyDropTarget.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], BodyDropTarget.prototype, \"ctrlsService\", void 0);\n__decorate([\n PostConstruct\n], BodyDropTarget.prototype, \"postConstruct\", null);\n__decorate([\n PostConstruct\n], BodyDropTarget.prototype, \"init\", null);\n","import { missing } from \"../../utils/generic.mjs\";\nexport class CssClassApplier {\n static getHeaderClassesFromColDef(abstractColDef, gridOptionsService, column, columnGroup) {\n if (missing(abstractColDef)) {\n return [];\n }\n return this.getColumnClassesFromCollDef(abstractColDef.headerClass, abstractColDef, gridOptionsService, column, columnGroup);\n }\n static getToolPanelClassesFromColDef(abstractColDef, gridOptionsService, column, columnGroup) {\n if (missing(abstractColDef)) {\n return [];\n }\n return this.getColumnClassesFromCollDef(abstractColDef.toolPanelClass, abstractColDef, gridOptionsService, column, columnGroup);\n }\n static getClassParams(abstractColDef, gridOptionsService, column, columnGroup) {\n return {\n // bad naming, as colDef here can be a group or a column,\n // however most people won't appreciate the difference,\n // so keeping it as colDef to avoid confusion.\n colDef: abstractColDef,\n column: column,\n columnGroup: columnGroup,\n api: gridOptionsService.api,\n columnApi: gridOptionsService.columnApi,\n context: gridOptionsService.context\n };\n }\n static getColumnClassesFromCollDef(classesOrFunc, abstractColDef, gridOptionsService, column, columnGroup) {\n if (missing(classesOrFunc)) {\n return [];\n }\n let classToUse;\n if (typeof classesOrFunc === 'function') {\n const params = this.getClassParams(abstractColDef, gridOptionsService, column, columnGroup);\n classToUse = classesOrFunc(params);\n }\n else {\n classToUse = classesOrFunc;\n }\n if (typeof classToUse === 'string') {\n return [classToUse];\n }\n if (Array.isArray(classToUse)) {\n return [...classToUse];\n }\n return [];\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PostConstruct, PreDestroy } from \"../../../context/context.mjs\";\nimport { removeAriaSort, setAriaDescription, setAriaSort } from \"../../../utils/aria.mjs\";\nimport { RefSelector } from \"../../../widgets/componentAnnotations.mjs\";\nimport { AbstractHeaderCellComp } from \"../abstractCell/abstractHeaderCellComp.mjs\";\nexport class HeaderCellComp extends AbstractHeaderCellComp {\n constructor(ctrl) {\n super(HeaderCellComp.TEMPLATE, ctrl);\n this.headerCompVersion = 0;\n this.column = ctrl.getColumnGroupChild();\n this.pinned = ctrl.getPinned();\n }\n postConstruct() {\n const eGui = this.getGui();\n const setAttribute = (name, value) => {\n if (value != null && value != '') {\n eGui.setAttribute(name, value);\n }\n else {\n eGui.removeAttribute(name);\n }\n };\n setAttribute('col-id', this.column.getColId());\n const compProxy = {\n setWidth: width => eGui.style.width = width,\n addOrRemoveCssClass: (cssClassName, on) => this.addOrRemoveCssClass(cssClassName, on),\n setAriaDescription: label => setAriaDescription(eGui, label),\n setAriaSort: sort => sort ? setAriaSort(eGui, sort) : removeAriaSort(eGui),\n setUserCompDetails: compDetails => this.setUserCompDetails(compDetails),\n getUserCompInstance: () => this.headerComp\n };\n this.ctrl.setComp(compProxy, this.getGui(), this.eResize, this.eHeaderCompWrapper);\n const selectAllGui = this.ctrl.getSelectAllGui();\n this.eResize.insertAdjacentElement('afterend', selectAllGui);\n }\n destroyHeaderComp() {\n if (this.headerComp) {\n this.eHeaderCompWrapper.removeChild(this.headerCompGui);\n this.headerComp = this.destroyBean(this.headerComp);\n this.headerCompGui = undefined;\n }\n }\n setUserCompDetails(compDetails) {\n this.headerCompVersion++;\n const versionCopy = this.headerCompVersion;\n compDetails.newAgStackInstance().then(comp => this.afterCompCreated(versionCopy, comp));\n }\n afterCompCreated(version, headerComp) {\n if (version != this.headerCompVersion || !this.isAlive()) {\n this.destroyBean(headerComp);\n return;\n }\n this.destroyHeaderComp();\n this.headerComp = headerComp;\n this.headerCompGui = headerComp.getGui();\n this.eHeaderCompWrapper.appendChild(this.headerCompGui);\n this.ctrl.setDragSource(this.getGui());\n }\n}\nHeaderCellComp.TEMPLATE = `
\n
\n
\n
`;\n__decorate([\n RefSelector('eResize')\n], HeaderCellComp.prototype, \"eResize\", void 0);\n__decorate([\n RefSelector('eHeaderCompWrapper')\n], HeaderCellComp.prototype, \"eHeaderCompWrapper\", void 0);\n__decorate([\n PostConstruct\n], HeaderCellComp.prototype, \"postConstruct\", null);\n__decorate([\n PreDestroy\n], HeaderCellComp.prototype, \"destroyHeaderComp\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from \"../../../context/context.mjs\";\nimport { setDisplayed } from \"../../../utils/dom.mjs\";\nimport { RefSelector } from \"../../../widgets/componentAnnotations.mjs\";\nimport { AbstractHeaderCellComp } from \"../abstractCell/abstractHeaderCellComp.mjs\";\nexport class HeaderGroupCellComp extends AbstractHeaderCellComp {\n constructor(ctrl) {\n super(HeaderGroupCellComp.TEMPLATE, ctrl);\n }\n postConstruct() {\n const eGui = this.getGui();\n const setAttribute = (key, value) => value != undefined ? eGui.setAttribute(key, value) : eGui.removeAttribute(key);\n eGui.setAttribute(\"col-id\", this.ctrl.getColId());\n const compProxy = {\n addOrRemoveCssClass: (cssClassName, on) => this.addOrRemoveCssClass(cssClassName, on),\n setResizableDisplayed: (displayed) => setDisplayed(this.eResize, displayed),\n setWidth: width => eGui.style.width = width,\n setAriaExpanded: expanded => setAttribute('aria-expanded', expanded),\n setUserCompDetails: details => this.setUserCompDetails(details)\n };\n this.ctrl.setComp(compProxy, eGui, this.eResize);\n }\n setUserCompDetails(details) {\n details.newAgStackInstance().then(comp => this.afterHeaderCompCreated(comp));\n }\n afterHeaderCompCreated(headerGroupComp) {\n const destroyFunc = () => this.destroyBean(headerGroupComp);\n if (!this.isAlive()) {\n destroyFunc();\n return;\n }\n const eGui = this.getGui();\n const eHeaderGroupGui = headerGroupComp.getGui();\n eGui.appendChild(eHeaderGroupGui);\n this.addDestroyFunc(destroyFunc);\n this.ctrl.setDragSource(eGui);\n }\n}\nHeaderGroupCellComp.TEMPLATE = `
\n
\n
`;\n__decorate([\n Autowired('userComponentFactory')\n], HeaderGroupCellComp.prototype, \"userComponentFactory\", void 0);\n__decorate([\n RefSelector('eResize')\n], HeaderGroupCellComp.prototype, \"eResize\", void 0);\n__decorate([\n PostConstruct\n], HeaderGroupCellComp.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PostConstruct, PreDestroy } from '../../context/context.mjs';\nimport { setAriaRowIndex } from '../../utils/aria.mjs';\nimport { setDomChildOrder } from '../../utils/dom.mjs';\nimport { getAllValuesInObject, iterateObject } from '../../utils/object.mjs';\nimport { Component } from '../../widgets/component.mjs';\nimport { HeaderCellComp } from '../cells/column/headerCellComp.mjs';\nimport { HeaderGroupCellComp } from '../cells/columnGroup/headerGroupCellComp.mjs';\nimport { HeaderFilterCellComp } from '../cells/floatingFilter/headerFilterCellComp.mjs';\nexport var HeaderRowType;\n(function (HeaderRowType) {\n HeaderRowType[\"COLUMN_GROUP\"] = \"group\";\n HeaderRowType[\"COLUMN\"] = \"column\";\n HeaderRowType[\"FLOATING_FILTER\"] = \"filter\";\n})(HeaderRowType || (HeaderRowType = {}));\nexport class HeaderRowComp extends Component {\n constructor(ctrl) {\n super();\n this.headerComps = {};\n this.ctrl = ctrl;\n this.setTemplate(/* html */ `
`);\n }\n //noinspection JSUnusedLocalSymbols\n init() {\n this.getGui().style.transform = this.ctrl.getTransform();\n setAriaRowIndex(this.getGui(), this.ctrl.getAriaRowIndex());\n const compProxy = {\n setHeight: height => this.getGui().style.height = height,\n setTop: top => this.getGui().style.top = top,\n setHeaderCtrls: (ctrls, forceOrder) => this.setHeaderCtrls(ctrls, forceOrder),\n setWidth: width => this.getGui().style.width = width,\n };\n this.ctrl.setComp(compProxy);\n }\n destroyHeaderCtrls() {\n this.setHeaderCtrls([], false);\n }\n setHeaderCtrls(ctrls, forceOrder) {\n if (!this.isAlive()) {\n return;\n }\n const oldComps = this.headerComps;\n this.headerComps = {};\n ctrls.forEach(ctrl => {\n const id = ctrl.getInstanceId();\n let comp = oldComps[id];\n delete oldComps[id];\n if (comp == null) {\n comp = this.createHeaderComp(ctrl);\n this.getGui().appendChild(comp.getGui());\n }\n this.headerComps[id] = comp;\n });\n iterateObject(oldComps, (id, comp) => {\n this.getGui().removeChild(comp.getGui());\n this.destroyBean(comp);\n });\n if (forceOrder) {\n const comps = getAllValuesInObject(this.headerComps);\n // ordering the columns by left position orders them in the order they appear on the screen\n comps.sort((a, b) => {\n const leftA = a.getCtrl().getColumnGroupChild().getLeft();\n const leftB = b.getCtrl().getColumnGroupChild().getLeft();\n return leftA - leftB;\n });\n const elementsInOrder = comps.map(c => c.getGui());\n setDomChildOrder(this.getGui(), elementsInOrder);\n }\n }\n createHeaderComp(headerCtrl) {\n let result;\n switch (this.ctrl.getType()) {\n case HeaderRowType.COLUMN_GROUP:\n result = new HeaderGroupCellComp(headerCtrl);\n break;\n case HeaderRowType.FLOATING_FILTER:\n result = new HeaderFilterCellComp(headerCtrl);\n break;\n default:\n result = new HeaderCellComp(headerCtrl);\n break;\n }\n this.createBean(result);\n result.setParentComponent(this);\n return result;\n }\n}\n__decorate([\n PostConstruct\n], HeaderRowComp.prototype, \"init\", null);\n__decorate([\n PreDestroy\n], HeaderRowComp.prototype, \"destroyHeaderCtrls\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../../context/beanStub.mjs\";\nimport { Autowired } from \"../../../context/context.mjs\";\nimport { isUserSuppressingHeaderKeyboardEvent } from \"../../../utils/keyboard.mjs\";\nimport { KeyCode } from \"../.././../constants/keyCode.mjs\";\nlet instanceIdSequence = 0;\nexport class AbstractHeaderCellCtrl extends BeanStub {\n constructor(columnGroupChild, parentRowCtrl) {\n super();\n this.lastFocusEvent = null;\n this.columnGroupChild = columnGroupChild;\n this.parentRowCtrl = parentRowCtrl;\n // unique id to this instance, including the column ID to help with debugging in React as it's used in 'key'\n this.instanceId = columnGroupChild.getUniqueId() + '-' + instanceIdSequence++;\n }\n shouldStopEventPropagation(e) {\n const { headerRowIndex, column } = this.focusService.getFocusedHeader();\n return isUserSuppressingHeaderKeyboardEvent(this.gridOptionsService, e, headerRowIndex, column);\n }\n getWrapperHasFocus() {\n const eDocument = this.gridOptionsService.getDocument();\n const activeEl = eDocument.activeElement;\n return activeEl === this.eGui;\n }\n setGui(eGui) {\n this.eGui = eGui;\n this.addDomData();\n }\n handleKeyDown(e) {\n const wrapperHasFocus = this.getWrapperHasFocus();\n switch (e.key) {\n case KeyCode.PAGE_DOWN:\n case KeyCode.PAGE_UP:\n case KeyCode.PAGE_HOME:\n case KeyCode.PAGE_END:\n if (wrapperHasFocus) {\n e.preventDefault();\n }\n }\n }\n addDomData() {\n const key = AbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL;\n this.gridOptionsService.setDomData(this.eGui, key, this);\n this.addDestroyFunc(() => this.gridOptionsService.setDomData(this.eGui, key, null));\n }\n getGui() {\n return this.eGui;\n }\n focus(event) {\n if (!this.eGui) {\n return false;\n }\n this.lastFocusEvent = event || null;\n this.eGui.focus();\n return true;\n }\n getRowIndex() {\n return this.parentRowCtrl.getRowIndex();\n }\n getParentRowCtrl() {\n return this.parentRowCtrl;\n }\n getPinned() {\n return this.parentRowCtrl.getPinned();\n }\n getInstanceId() {\n return this.instanceId;\n }\n getColumnGroupChild() {\n return this.columnGroupChild;\n }\n}\nAbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL = 'headerCtrl';\n__decorate([\n Autowired('focusService')\n], AbstractHeaderCellCtrl.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('beans')\n], AbstractHeaderCellCtrl.prototype, \"beans\", void 0);\n__decorate([\n Autowired('userComponentFactory')\n], AbstractHeaderCellCtrl.prototype, \"userComponentFactory\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Column } from \"../../entities/column.mjs\";\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { PostConstruct } from \"../../context/context.mjs\";\nimport { setAriaColIndex, setAriaColSpan } from \"../../utils/aria.mjs\";\nimport { last } from \"../../utils/array.mjs\";\nimport { exists } from \"../../utils/generic.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nexport class SetLeftFeature extends BeanStub {\n constructor(columnOrGroup, eCell, beans, colsSpanning) {\n super();\n this.columnOrGroup = columnOrGroup;\n this.eCell = eCell;\n this.ariaEl = this.eCell.querySelector('[role=columnheader]') || this.eCell;\n this.colsSpanning = colsSpanning;\n this.beans = beans;\n }\n setColsSpanning(colsSpanning) {\n this.colsSpanning = colsSpanning;\n this.onLeftChanged();\n }\n getColumnOrGroup() {\n if (this.beans.gridOptionsService.is('enableRtl') && this.colsSpanning) {\n return last(this.colsSpanning);\n }\n return this.columnOrGroup;\n }\n postConstruct() {\n this.addManagedListener(this.columnOrGroup, Column.EVENT_LEFT_CHANGED, this.onLeftChanged.bind(this));\n this.setLeftFirstTime();\n // when in print layout, the left position is also dependent on the width of the pinned sections.\n // so additionally update left if any column width changes.\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onLeftChanged.bind(this));\n // setting left has a dependency on print layout\n this.addManagedPropertyListener('domLayout', this.onLeftChanged.bind(this));\n }\n setLeftFirstTime() {\n const suppressMoveAnimation = this.beans.gridOptionsService.is('suppressColumnMoveAnimation');\n const oldLeftExists = exists(this.columnOrGroup.getOldLeft());\n const animateColumnMove = this.beans.columnAnimationService.isActive() && oldLeftExists && !suppressMoveAnimation;\n if (animateColumnMove) {\n this.animateInLeft();\n }\n else {\n this.onLeftChanged();\n }\n }\n animateInLeft() {\n const colOrGroup = this.getColumnOrGroup();\n const left = colOrGroup.getLeft();\n const oldLeft = colOrGroup.getOldLeft();\n const oldActualLeft = this.modifyLeftForPrintLayout(colOrGroup, oldLeft);\n const actualLeft = this.modifyLeftForPrintLayout(colOrGroup, left);\n this.setLeft(oldActualLeft);\n // we must keep track of the left we want to set to, as this would otherwise lead to a race\n // condition, if the user changed the left value many times in one VM turn, then we want to make\n // make sure the actualLeft we set in the timeout below (in the next VM turn) is the correct left\n // position. eg if user changes column position twice, then setLeft() below executes twice in next\n // VM turn, but only one (the correct one) should get applied.\n this.actualLeft = actualLeft;\n this.beans.columnAnimationService.executeNextVMTurn(() => {\n // test this left value is the latest one to be applied, and if not, do nothing\n if (this.actualLeft === actualLeft) {\n this.setLeft(actualLeft);\n }\n });\n }\n onLeftChanged() {\n const colOrGroup = this.getColumnOrGroup();\n const left = colOrGroup.getLeft();\n this.actualLeft = this.modifyLeftForPrintLayout(colOrGroup, left);\n this.setLeft(this.actualLeft);\n }\n modifyLeftForPrintLayout(colOrGroup, leftPosition) {\n const printLayout = this.beans.gridOptionsService.isDomLayout('print');\n if (!printLayout) {\n return leftPosition;\n }\n if (colOrGroup.getPinned() === 'left') {\n return leftPosition;\n }\n const leftWidth = this.beans.columnModel.getDisplayedColumnsLeftWidth();\n if (colOrGroup.getPinned() === 'right') {\n const bodyWidth = this.beans.columnModel.getBodyContainerWidth();\n return leftWidth + bodyWidth + leftPosition;\n }\n // is in body\n return leftWidth + leftPosition;\n }\n setLeft(value) {\n // if the value is null, then that means the column is no longer\n // displayed. there is logic in the rendering to fade these columns\n // out, so we don't try and change their left positions.\n if (exists(value)) {\n this.eCell.style.left = `${value}px`;\n }\n let indexColumn;\n if (this.columnOrGroup instanceof Column) {\n indexColumn = this.columnOrGroup;\n }\n else {\n const columnGroup = this.columnOrGroup;\n const children = columnGroup.getLeafColumns();\n if (!children.length) {\n return;\n }\n if (children.length > 1) {\n setAriaColSpan(this.ariaEl, children.length);\n }\n indexColumn = children[0];\n }\n const index = this.beans.columnModel.getAriaColumnIndex(indexColumn);\n setAriaColIndex(this.ariaEl, index);\n }\n}\n__decorate([\n PostConstruct\n], SetLeftFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired, PostConstruct } from \"../../context/context.mjs\";\nexport class HoverFeature extends BeanStub {\n constructor(columns, element) {\n super();\n this.columns = columns;\n this.element = element;\n }\n postConstruct() {\n if (this.gridOptionsService.is('columnHoverHighlight')) {\n this.addMouseHoverListeners();\n }\n }\n addMouseHoverListeners() {\n this.addManagedListener(this.element, 'mouseout', this.onMouseOut.bind(this));\n this.addManagedListener(this.element, 'mouseover', this.onMouseOver.bind(this));\n }\n onMouseOut() {\n this.columnHoverService.clearMouseOver();\n }\n onMouseOver() {\n this.columnHoverService.setMouseOver(this.columns);\n }\n}\n__decorate([\n Autowired('columnHoverService')\n], HoverFeature.prototype, \"columnHoverService\", void 0);\n__decorate([\n PostConstruct\n], HoverFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { AbstractHeaderCellCtrl } from \"../abstractCell/abstractHeaderCellCtrl.mjs\";\nimport { KeyCode } from '../../../constants/keyCode.mjs';\nimport { Autowired } from '../../../context/context.mjs';\nimport { Column } from '../../../entities/column.mjs';\nimport { Events } from '../../../events.mjs';\nimport { SetLeftFeature } from '../../../rendering/features/setLeftFeature.mjs';\nimport { isElementChildOfClass } from '../../../utils/dom.mjs';\nimport { createIconNoSpan } from '../../../utils/icon.mjs';\nimport { ManagedFocusFeature } from '../../../widgets/managedFocusFeature.mjs';\nimport { HoverFeature } from '../hoverFeature.mjs';\nimport { setAriaLabel } from \"../../../utils/aria.mjs\";\nexport class HeaderFilterCellCtrl extends AbstractHeaderCellCtrl {\n constructor(column, parentRowCtrl) {\n super(column, parentRowCtrl);\n this.iconCreated = false;\n this.column = column;\n }\n setComp(comp, eGui, eButtonShowMainFilter, eFloatingFilterBody) {\n super.setGui(eGui);\n this.comp = comp;\n this.eButtonShowMainFilter = eButtonShowMainFilter;\n this.eFloatingFilterBody = eFloatingFilterBody;\n this.setupActive();\n this.setupWidth();\n this.setupLeft();\n this.setupHover();\n this.setupFocus();\n this.setupAria();\n this.setupFilterButton();\n this.setupUserComp();\n this.setupSyncWithFilter();\n this.setupUi();\n this.addManagedListener(this.eButtonShowMainFilter, 'click', this.showParentFilter.bind(this));\n this.setupFilterChangedListener();\n this.addManagedListener(this.column, Column.EVENT_COL_DEF_CHANGED, this.onColDefChanged.bind(this));\n }\n setupActive() {\n const colDef = this.column.getColDef();\n const filterExists = !!colDef.filter;\n const floatingFilterExists = !!colDef.floatingFilter;\n this.active = filterExists && floatingFilterExists;\n }\n setupUi() {\n this.comp.setButtonWrapperDisplayed(!this.suppressFilterButton && this.active);\n this.comp.addOrRemoveBodyCssClass('ag-floating-filter-full-body', this.suppressFilterButton);\n this.comp.addOrRemoveBodyCssClass('ag-floating-filter-body', !this.suppressFilterButton);\n if (!this.active || this.iconCreated) {\n return;\n }\n const eMenuIcon = createIconNoSpan('filter', this.gridOptionsService, this.column);\n if (eMenuIcon) {\n this.iconCreated = true;\n this.eButtonShowMainFilter.appendChild(eMenuIcon);\n }\n }\n setupFocus() {\n this.createManagedBean(new ManagedFocusFeature(this.eGui, {\n shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this),\n onTabKeyDown: this.onTabKeyDown.bind(this),\n handleKeyDown: this.handleKeyDown.bind(this),\n onFocusIn: this.onFocusIn.bind(this)\n }));\n }\n setupAria() {\n const localeTextFunc = this.localeService.getLocaleTextFunc();\n setAriaLabel(this.eButtonShowMainFilter, localeTextFunc('ariaFilterMenuOpen', 'Open Filter Menu'));\n }\n onTabKeyDown(e) {\n const eDocument = this.gridOptionsService.getDocument();\n const activeEl = eDocument.activeElement;\n const wrapperHasFocus = activeEl === this.eGui;\n if (wrapperHasFocus) {\n return;\n }\n const nextFocusableEl = this.focusService.findNextFocusableElement(this.eGui, null, e.shiftKey);\n if (nextFocusableEl) {\n this.beans.headerNavigationService.scrollToColumn(this.column);\n e.preventDefault();\n nextFocusableEl.focus();\n return;\n }\n const nextFocusableColumn = this.findNextColumnWithFloatingFilter(e.shiftKey);\n if (!nextFocusableColumn) {\n return;\n }\n if (this.focusService.focusHeaderPosition({\n headerPosition: {\n headerRowIndex: this.getParentRowCtrl().getRowIndex(),\n column: nextFocusableColumn\n },\n event: e\n })) {\n e.preventDefault();\n }\n }\n findNextColumnWithFloatingFilter(backwards) {\n const columModel = this.beans.columnModel;\n let nextCol = this.column;\n do {\n nextCol = backwards\n ? columModel.getDisplayedColBefore(nextCol)\n : columModel.getDisplayedColAfter(nextCol);\n if (!nextCol) {\n break;\n }\n } while (!nextCol.getColDef().filter || !nextCol.getColDef().floatingFilter);\n return nextCol;\n }\n handleKeyDown(e) {\n super.handleKeyDown(e);\n const wrapperHasFocus = this.getWrapperHasFocus();\n switch (e.key) {\n case KeyCode.UP:\n case KeyCode.DOWN:\n if (!wrapperHasFocus) {\n e.preventDefault();\n }\n case KeyCode.LEFT:\n case KeyCode.RIGHT:\n if (wrapperHasFocus) {\n return;\n }\n e.stopPropagation();\n case KeyCode.ENTER:\n if (wrapperHasFocus) {\n if (this.focusService.focusInto(this.eGui)) {\n e.preventDefault();\n }\n }\n break;\n case KeyCode.ESCAPE:\n if (!wrapperHasFocus) {\n this.eGui.focus();\n }\n }\n }\n onFocusIn(e) {\n const isRelatedWithin = this.eGui.contains(e.relatedTarget);\n // when the focus is already within the component,\n // we default to the browser's behavior\n if (isRelatedWithin) {\n return;\n }\n const notFromHeaderWrapper = !!e.relatedTarget && !e.relatedTarget.classList.contains('ag-floating-filter');\n const fromWithinHeader = !!e.relatedTarget && isElementChildOfClass(e.relatedTarget, 'ag-floating-filter');\n if (notFromHeaderWrapper && fromWithinHeader && e.target === this.eGui) {\n const lastFocusEvent = this.lastFocusEvent;\n const fromTab = !!(lastFocusEvent && lastFocusEvent.key === KeyCode.TAB);\n if (lastFocusEvent && fromTab) {\n const shouldFocusLast = lastFocusEvent.shiftKey;\n this.focusService.focusInto(this.eGui, shouldFocusLast);\n }\n }\n const rowIndex = this.getRowIndex();\n this.beans.focusService.setFocusedHeader(rowIndex, this.column);\n }\n setupHover() {\n this.createManagedBean(new HoverFeature([this.column], this.eGui));\n const listener = () => {\n if (!this.gridOptionsService.is('columnHoverHighlight')) {\n return;\n }\n const hovered = this.columnHoverService.isHovered(this.column);\n this.comp.addOrRemoveCssClass('ag-column-hover', hovered);\n };\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, listener);\n listener();\n }\n setupLeft() {\n const setLeftFeature = new SetLeftFeature(this.column, this.eGui, this.beans);\n this.createManagedBean(setLeftFeature);\n }\n setupFilterButton() {\n const colDef = this.column.getColDef();\n // this is unusual - we need a params value OUTSIDE the component the params are for.\n // the params are for the floating filter component, but this property is actually for the wrapper.\n this.suppressFilterButton = colDef.floatingFilterComponentParams ? !!colDef.floatingFilterComponentParams.suppressFilterButton : false;\n }\n setupUserComp() {\n if (!this.active) {\n return;\n }\n const compDetails = this.filterManager.getFloatingFilterCompDetails(this.column, () => this.showParentFilter());\n if (compDetails) {\n this.setCompDetails(compDetails);\n }\n }\n setCompDetails(compDetails) {\n this.userCompDetails = compDetails;\n this.comp.setCompDetails(compDetails);\n }\n showParentFilter() {\n const eventSource = this.suppressFilterButton ? this.eFloatingFilterBody : this.eButtonShowMainFilter;\n this.menuFactory.showMenuAfterButtonClick(this.column, eventSource, 'floatingFilter', 'filterMenuTab', ['filterMenuTab']);\n }\n setupSyncWithFilter() {\n if (!this.active) {\n return;\n }\n const syncWithFilter = (filterChangedEvent) => {\n const compPromise = this.comp.getFloatingFilterComp();\n if (!compPromise) {\n return;\n }\n compPromise.then(comp => {\n if (comp) {\n const parentModel = this.filterManager.getCurrentFloatingFilterParentModel(this.column);\n comp.onParentModelChanged(parentModel, filterChangedEvent);\n }\n });\n };\n this.destroySyncListener = this.addManagedListener(this.column, Column.EVENT_FILTER_CHANGED, syncWithFilter);\n if (this.filterManager.isFilterActive(this.column)) {\n syncWithFilter(null);\n }\n }\n setupWidth() {\n const listener = () => {\n const width = `${this.column.getActualWidth()}px`;\n this.comp.setWidth(width);\n };\n this.addManagedListener(this.column, Column.EVENT_WIDTH_CHANGED, listener);\n listener();\n }\n setupFilterChangedListener() {\n if (this.active) {\n this.destroyFilterChangedListener = this.addManagedListener(this.column, Column.EVENT_FILTER_CHANGED, this.updateFilterButton.bind(this));\n }\n }\n updateFilterButton() {\n if (!this.suppressFilterButton && this.comp) {\n this.comp.setButtonWrapperDisplayed(this.filterManager.isFilterAllowed(this.column));\n }\n }\n onColDefChanged() {\n var _a, _b;\n const wasActive = this.active;\n this.setupActive();\n const becomeActive = !wasActive && this.active;\n if (wasActive && !this.active) {\n (_a = this.destroySyncListener) === null || _a === void 0 ? void 0 : _a.call(this);\n (_b = this.destroyFilterChangedListener) === null || _b === void 0 ? void 0 : _b.call(this);\n }\n const newCompDetails = this.active\n ? this.filterManager.getFloatingFilterCompDetails(this.column, () => this.showParentFilter())\n : null;\n const compPromise = this.comp.getFloatingFilterComp();\n if (!compPromise || !newCompDetails) {\n this.updateCompDetails(newCompDetails, becomeActive);\n }\n else {\n compPromise.then(compInstance => {\n var _a;\n if (!compInstance || this.filterManager.areFilterCompsDifferent((_a = this.userCompDetails) !== null && _a !== void 0 ? _a : null, newCompDetails)) {\n this.updateCompDetails(newCompDetails, becomeActive);\n }\n else {\n this.updateFloatingFilterParams(newCompDetails);\n }\n });\n }\n }\n updateCompDetails(compDetails, becomeActive) {\n this.setCompDetails(compDetails);\n // filter button and UI can change based on params, so always want to update\n this.setupFilterButton();\n this.setupUi();\n if (becomeActive) {\n this.setupSyncWithFilter();\n this.setupFilterChangedListener();\n }\n }\n updateFloatingFilterParams(userCompDetails) {\n var _a;\n if (!userCompDetails) {\n return;\n }\n const params = userCompDetails.params;\n (_a = this.comp.getFloatingFilterComp()) === null || _a === void 0 ? void 0 : _a.then(floatingFilter => {\n if ((floatingFilter === null || floatingFilter === void 0 ? void 0 : floatingFilter.onParamsUpdated) && typeof floatingFilter.onParamsUpdated === 'function') {\n floatingFilter.onParamsUpdated(params);\n }\n });\n }\n}\n__decorate([\n Autowired('filterManager')\n], HeaderFilterCellCtrl.prototype, \"filterManager\", void 0);\n__decorate([\n Autowired('columnHoverService')\n], HeaderFilterCellCtrl.prototype, \"columnHoverService\", void 0);\n__decorate([\n Autowired('menuFactory')\n], HeaderFilterCellCtrl.prototype, \"menuFactory\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../../context/beanStub.mjs\";\nimport { Autowired, PostConstruct } from \"../../../context/context.mjs\";\nimport { setDisplayed } from \"../../../utils/dom.mjs\";\nimport { TouchListener } from \"../../../widgets/touchListener.mjs\";\nexport class ResizeFeature extends BeanStub {\n constructor(pinned, column, eResize, comp, ctrl) {\n super();\n this.pinned = pinned;\n this.column = column;\n this.eResize = eResize;\n this.comp = comp;\n this.ctrl = ctrl;\n }\n postConstruct() {\n const colDef = this.column.getColDef();\n const destroyResizeFuncs = [];\n let canResize;\n let canAutosize;\n const addResize = () => {\n setDisplayed(this.eResize, canResize);\n if (!canResize) {\n return;\n }\n const finishedWithResizeFunc = this.horizontalResizeService.addResizeBar({\n eResizeBar: this.eResize,\n onResizeStart: this.onResizeStart.bind(this),\n onResizing: this.onResizing.bind(this, false),\n onResizeEnd: this.onResizing.bind(this, true)\n });\n destroyResizeFuncs.push(finishedWithResizeFunc);\n if (canAutosize) {\n const skipHeaderOnAutoSize = this.gridOptionsService.is('skipHeaderOnAutoSize');\n const autoSizeColListener = () => {\n this.columnModel.autoSizeColumn(this.column, skipHeaderOnAutoSize, \"uiColumnResized\");\n };\n this.eResize.addEventListener('dblclick', autoSizeColListener);\n const touchListener = new TouchListener(this.eResize);\n touchListener.addEventListener(TouchListener.EVENT_DOUBLE_TAP, autoSizeColListener);\n this.addDestroyFunc(() => {\n this.eResize.removeEventListener('dblclick', autoSizeColListener);\n touchListener.removeEventListener(TouchListener.EVENT_DOUBLE_TAP, autoSizeColListener);\n touchListener.destroy();\n });\n }\n };\n const removeResize = () => {\n destroyResizeFuncs.forEach(f => f());\n destroyResizeFuncs.length = 0;\n };\n const refresh = () => {\n const resize = this.column.isResizable();\n const autoSize = !this.gridOptionsService.is('suppressAutoSize') && !colDef.suppressAutoSize;\n const propertyChange = resize !== canResize || autoSize !== canAutosize;\n if (propertyChange) {\n canResize = resize;\n canAutosize = autoSize;\n removeResize();\n addResize();\n }\n };\n refresh();\n this.addDestroyFunc(removeResize);\n this.ctrl.addRefreshFunction(refresh);\n }\n onResizing(finished, resizeAmount) {\n const resizeAmountNormalised = this.normaliseResizeAmount(resizeAmount);\n const columnWidths = [{ key: this.column, newWidth: this.resizeStartWidth + resizeAmountNormalised }];\n this.columnModel.setColumnWidths(columnWidths, this.resizeWithShiftKey, finished, \"uiColumnResized\");\n if (finished) {\n this.comp.addOrRemoveCssClass('ag-column-resizing', false);\n }\n }\n onResizeStart(shiftKey) {\n this.resizeStartWidth = this.column.getActualWidth();\n this.resizeWithShiftKey = shiftKey;\n this.comp.addOrRemoveCssClass('ag-column-resizing', true);\n }\n // optionally inverts the drag, depending on pinned and RTL\n // note - this method is duplicated in RenderedHeaderGroupCell - should refactor out?\n normaliseResizeAmount(dragChange) {\n let result = dragChange;\n const notPinningLeft = this.pinned !== 'left';\n const pinningRight = this.pinned === 'right';\n if (this.gridOptionsService.is('enableRtl')) {\n // for RTL, dragging left makes the col bigger, except when pinning left\n if (notPinningLeft) {\n result *= -1;\n }\n }\n else {\n // for LTR (ie normal), dragging left makes the col smaller, except when pinning right\n if (pinningRight) {\n result *= -1;\n }\n }\n return result;\n }\n}\n__decorate([\n Autowired('horizontalResizeService')\n], ResizeFeature.prototype, \"horizontalResizeService\", void 0);\n__decorate([\n Autowired('columnModel')\n], ResizeFeature.prototype, \"columnModel\", void 0);\n__decorate([\n PostConstruct\n], ResizeFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { AgCheckbox } from \"../../../widgets/agCheckbox.mjs\";\nimport { BeanStub } from \"../../../context/beanStub.mjs\";\nimport { Autowired } from \"../../../context/context.mjs\";\nimport { Events } from \"../../../events.mjs\";\nimport { setAriaHidden, setAriaRole } from \"../../../utils/aria.mjs\";\nexport class SelectAllFeature extends BeanStub {\n constructor(column) {\n super();\n this.cbSelectAllVisible = false;\n this.processingEventFromCheckbox = false;\n this.column = column;\n const colDef = column.getColDef();\n this.filteredOnly = !!(colDef === null || colDef === void 0 ? void 0 : colDef.headerCheckboxSelectionFilteredOnly);\n this.currentPageOnly = !!(colDef === null || colDef === void 0 ? void 0 : colDef.headerCheckboxSelectionCurrentPageOnly);\n }\n onSpaceKeyDown(e) {\n const checkbox = this.cbSelectAll;\n const eDocument = this.gridOptionsService.getDocument();\n if (checkbox.isDisplayed() && !checkbox.getGui().contains(eDocument.activeElement)) {\n e.preventDefault();\n checkbox.setValue(!checkbox.getValue());\n }\n }\n getCheckboxGui() {\n return this.cbSelectAll.getGui();\n }\n setComp(ctrl) {\n this.headerCellCtrl = ctrl;\n this.cbSelectAll = this.createManagedBean(new AgCheckbox());\n this.cbSelectAll.addCssClass('ag-header-select-all');\n setAriaRole(this.cbSelectAll.getGui(), 'presentation');\n this.showOrHideSelectAll();\n this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.showOrHideSelectAll.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.showOrHideSelectAll.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_SELECTION_CHANGED, this.onSelectionChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_PAGINATION_CHANGED, this.onSelectionChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, this.onModelChanged.bind(this));\n this.addManagedListener(this.cbSelectAll, Events.EVENT_FIELD_VALUE_CHANGED, this.onCbSelectAll.bind(this));\n setAriaHidden(this.cbSelectAll.getGui(), true);\n this.cbSelectAll.getInputElement().setAttribute('tabindex', '-1');\n this.refreshSelectAllLabel();\n }\n showOrHideSelectAll() {\n this.cbSelectAllVisible = this.isCheckboxSelection();\n this.cbSelectAll.setDisplayed(this.cbSelectAllVisible, { skipAriaHidden: true });\n if (this.cbSelectAllVisible) {\n // in case user is trying this feature with the wrong model type\n this.checkRightRowModelType('selectAllCheckbox');\n // make sure checkbox is showing the right state\n this.updateStateOfCheckbox();\n }\n this.refreshSelectAllLabel();\n }\n onModelChanged() {\n if (!this.cbSelectAllVisible) {\n return;\n }\n this.updateStateOfCheckbox();\n }\n onSelectionChanged() {\n if (!this.cbSelectAllVisible) {\n return;\n }\n this.updateStateOfCheckbox();\n }\n updateStateOfCheckbox() {\n if (this.processingEventFromCheckbox) {\n return;\n }\n this.processingEventFromCheckbox = true;\n const allSelected = this.selectionService.getSelectAllState(this.filteredOnly, this.currentPageOnly);\n this.cbSelectAll.setValue(allSelected);\n this.refreshSelectAllLabel();\n this.processingEventFromCheckbox = false;\n }\n refreshSelectAllLabel() {\n const translate = this.localeService.getLocaleTextFunc();\n const checked = this.cbSelectAll.getValue();\n const ariaStatus = checked ? translate('ariaChecked', 'checked') : translate('ariaUnchecked', 'unchecked');\n const ariaLabel = translate('ariaRowSelectAll', 'Press Space to toggle all rows selection');\n if (!this.cbSelectAllVisible) {\n this.headerCellCtrl.setAriaDescriptionProperty('selectAll', null);\n }\n else {\n this.headerCellCtrl.setAriaDescriptionProperty('selectAll', `${ariaLabel} (${ariaStatus})`);\n }\n this.cbSelectAll.setInputAriaLabel(`${ariaLabel} (${ariaStatus})`);\n this.headerCellCtrl.refreshAriaDescription();\n }\n checkRightRowModelType(feature) {\n const rowModelType = this.rowModel.getType();\n const rowModelMatches = rowModelType === 'clientSide' || rowModelType === 'serverSide';\n if (!rowModelMatches) {\n console.warn(`AG Grid: ${feature} is only available if using 'clientSide' or 'serverSide' rowModelType, you are using ${rowModelType}.`);\n return false;\n }\n return true;\n }\n onCbSelectAll() {\n if (this.processingEventFromCheckbox) {\n return;\n }\n if (!this.cbSelectAllVisible) {\n return;\n }\n const value = this.cbSelectAll.getValue();\n let source = 'uiSelectAll';\n if (this.currentPageOnly)\n source = 'uiSelectAllCurrentPage';\n else if (this.filteredOnly)\n source = 'uiSelectAllFiltered';\n const params = {\n source,\n justFiltered: this.filteredOnly,\n justCurrentPage: this.currentPageOnly,\n };\n if (value) {\n this.selectionService.selectAllRowNodes(params);\n }\n else {\n this.selectionService.deselectAllRowNodes(params);\n }\n }\n isCheckboxSelection() {\n let result = this.column.getColDef().headerCheckboxSelection;\n if (typeof result === 'function') {\n const func = result;\n const params = {\n column: this.column,\n colDef: this.column.getColDef(),\n columnApi: this.columnApi,\n api: this.gridApi,\n context: this.gridOptionsService.context\n };\n result = func(params);\n }\n if (result) {\n return this.checkRightRowModelType('headerCheckboxSelection');\n }\n return false;\n }\n}\n__decorate([\n Autowired('gridApi')\n], SelectAllFeature.prototype, \"gridApi\", void 0);\n__decorate([\n Autowired('columnApi')\n], SelectAllFeature.prototype, \"columnApi\", void 0);\n__decorate([\n Autowired('rowModel')\n], SelectAllFeature.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('selectionService')\n], SelectAllFeature.prototype, \"selectionService\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { ManagedFocusFeature } from \"./managedFocusFeature.mjs\";\nexport var TabGuardClassNames;\n(function (TabGuardClassNames) {\n TabGuardClassNames[\"TAB_GUARD\"] = \"ag-tab-guard\";\n TabGuardClassNames[\"TAB_GUARD_TOP\"] = \"ag-tab-guard-top\";\n TabGuardClassNames[\"TAB_GUARD_BOTTOM\"] = \"ag-tab-guard-bottom\";\n})(TabGuardClassNames || (TabGuardClassNames = {}));\n;\nexport class TabGuardCtrl extends BeanStub {\n constructor(params) {\n super();\n this.skipTabGuardFocus = false;\n const { comp, eTopGuard, eBottomGuard, focusInnerElement, onFocusIn, onFocusOut, shouldStopEventPropagation, onTabKeyDown, handleKeyDown, eFocusableElement } = params;\n this.comp = comp;\n this.eTopGuard = eTopGuard;\n this.eBottomGuard = eBottomGuard;\n this.providedFocusInnerElement = focusInnerElement;\n this.eFocusableElement = eFocusableElement;\n this.providedFocusIn = onFocusIn;\n this.providedFocusOut = onFocusOut;\n this.providedShouldStopEventPropagation = shouldStopEventPropagation;\n this.providedOnTabKeyDown = onTabKeyDown;\n this.providedHandleKeyDown = handleKeyDown;\n }\n postConstruct() {\n this.createManagedBean(new ManagedFocusFeature(this.eFocusableElement, {\n shouldStopEventPropagation: () => this.shouldStopEventPropagation(),\n onTabKeyDown: e => this.onTabKeyDown(e),\n handleKeyDown: e => this.handleKeyDown(e),\n onFocusIn: e => this.onFocusIn(e),\n onFocusOut: e => this.onFocusOut(e)\n }));\n this.activateTabGuards();\n [this.eTopGuard, this.eBottomGuard].forEach(guard => this.addManagedListener(guard, 'focus', this.onFocus.bind(this)));\n }\n handleKeyDown(e) {\n if (this.providedHandleKeyDown) {\n this.providedHandleKeyDown(e);\n }\n }\n tabGuardsAreActive() {\n return !!this.eTopGuard && this.eTopGuard.hasAttribute('tabIndex');\n }\n shouldStopEventPropagation() {\n if (this.providedShouldStopEventPropagation) {\n return this.providedShouldStopEventPropagation();\n }\n return false;\n }\n activateTabGuards() {\n const tabIndex = this.gridOptionsService.getNum('tabIndex') || 0;\n this.comp.setTabIndex(tabIndex.toString());\n }\n deactivateTabGuards() {\n this.comp.setTabIndex();\n }\n onFocus(e) {\n if (this.skipTabGuardFocus) {\n this.skipTabGuardFocus = false;\n return;\n }\n const fromBottom = e.target === this.eBottomGuard;\n if (this.providedFocusInnerElement) {\n this.providedFocusInnerElement(fromBottom);\n }\n else {\n this.focusInnerElement(fromBottom);\n }\n }\n onFocusIn(e) {\n if (this.providedFocusIn && this.providedFocusIn(e)) {\n return;\n }\n this.deactivateTabGuards();\n }\n onFocusOut(e) {\n if (this.providedFocusOut && this.providedFocusOut(e)) {\n return;\n }\n if (!this.eFocusableElement.contains(e.relatedTarget)) {\n this.activateTabGuards();\n }\n }\n onTabKeyDown(e) {\n if (this.providedOnTabKeyDown) {\n this.providedOnTabKeyDown(e);\n return;\n }\n if (e.defaultPrevented) {\n return;\n }\n const tabGuardsAreActive = this.tabGuardsAreActive();\n if (tabGuardsAreActive) {\n this.deactivateTabGuards();\n }\n const nextRoot = this.getNextFocusableElement(e.shiftKey);\n if (tabGuardsAreActive) {\n // ensure the tab guards are only re-instated once the event has finished processing, to avoid the browser\n // tabbing to the tab guard from inside the component\n setTimeout(() => this.activateTabGuards(), 0);\n }\n if (!nextRoot) {\n return;\n }\n nextRoot.focus();\n e.preventDefault();\n }\n focusInnerElement(fromBottom = false) {\n const focusable = this.focusService.findFocusableElements(this.eFocusableElement);\n if (this.tabGuardsAreActive()) {\n // remove tab guards from this component from list of focusable elements\n focusable.splice(0, 1);\n focusable.splice(focusable.length - 1, 1);\n }\n if (!focusable.length) {\n return;\n }\n focusable[fromBottom ? focusable.length - 1 : 0].focus({ preventScroll: true });\n }\n getNextFocusableElement(backwards) {\n return this.focusService.findNextFocusableElement(this.eFocusableElement, false, backwards);\n }\n forceFocusOutOfContainer(up = false) {\n const tabGuardToFocus = up ? this.eTopGuard : this.eBottomGuard;\n this.activateTabGuards();\n this.skipTabGuardFocus = true;\n tabGuardToFocus.focus();\n }\n}\n__decorate([\n Autowired('focusService')\n], TabGuardCtrl.prototype, \"focusService\", void 0);\n__decorate([\n PostConstruct\n], TabGuardCtrl.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar FocusService_1;\nimport { Autowired, Bean, Optional, PostConstruct } from \"./context/context.mjs\";\nimport { BeanStub } from \"./context/beanStub.mjs\";\nimport { Events } from \"./events.mjs\";\nimport { ManagedFocusFeature } from \"./widgets/managedFocusFeature.mjs\";\nimport { getTabIndex } from './utils/browser.mjs';\nimport { makeNull } from './utils/generic.mjs';\nimport { RowCtrl } from \"./rendering/row/rowCtrl.mjs\";\nimport { AbstractHeaderCellCtrl } from \"./headerRendering/cells/abstractCell/abstractHeaderCellCtrl.mjs\";\nimport { last } from \"./utils/array.mjs\";\nimport { FOCUSABLE_EXCLUDE, FOCUSABLE_SELECTOR } from \"./utils/dom.mjs\";\nimport { TabGuardClassNames } from \"./widgets/tabGuardCtrl.mjs\";\nlet FocusService = FocusService_1 = class FocusService extends BeanStub {\n /**\n * Adds a gridCore to the list of the gridCores monitoring Keyboard Mode\n * in a specific HTMLDocument.\n *\n * @param doc {Document} - The Document containing the gridCore.\n * @param gridCore {GridComp} - The GridCore to be monitored.\n */\n static addKeyboardModeEvents(doc, controller) {\n const docControllers = FocusService_1.instancesMonitored.get(doc);\n if (docControllers && docControllers.length > 0) {\n if (docControllers.indexOf(controller) === -1) {\n docControllers.push(controller);\n }\n }\n else {\n FocusService_1.instancesMonitored.set(doc, [controller]);\n doc.addEventListener('keydown', FocusService_1.toggleKeyboardMode);\n doc.addEventListener('mousedown', FocusService_1.toggleKeyboardMode);\n }\n }\n /**\n * Removes a gridCore from the list of the gridCores monitoring Keyboard Mode\n * in a specific HTMLDocument.\n *\n * @param doc {Document} - The Document containing the gridCore.\n * @param gridCore {GridComp} - The GridCore to be removed.\n */\n static removeKeyboardModeEvents(doc, controller) {\n const docControllers = FocusService_1.instancesMonitored.get(doc);\n let newControllers = [];\n if (docControllers && docControllers.length) {\n newControllers = [...docControllers].filter(currentGridCore => currentGridCore !== controller);\n FocusService_1.instancesMonitored.set(doc, newControllers);\n }\n if (newControllers.length === 0) {\n doc.removeEventListener('keydown', FocusService_1.toggleKeyboardMode);\n doc.removeEventListener('mousedown', FocusService_1.toggleKeyboardMode);\n }\n }\n /**\n * This method will be called by `keydown` and `mousedown` events on all Documents monitoring\n * KeyboardMode. It will then fire a KEYBOARD_FOCUS, MOUSE_FOCUS on each gridCore present in\n * the Document allowing each gridCore to maintain a state for KeyboardMode.\n *\n * @param event {KeyboardEvent | MouseEvent | TouchEvent} - The event triggered.\n */\n static toggleKeyboardMode(event) {\n const isKeyboardActive = FocusService_1.keyboardModeActive;\n const isKeyboardEvent = event.type === 'keydown';\n if (isKeyboardEvent) {\n // the following keys should not toggle keyboard mode.\n if (event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n }\n if (isKeyboardActive && isKeyboardEvent || !isKeyboardActive && !isKeyboardEvent) {\n return;\n }\n FocusService_1.keyboardModeActive = isKeyboardEvent;\n const doc = event.target.ownerDocument;\n if (!doc) {\n return;\n }\n const controllersForDoc = FocusService_1.instancesMonitored.get(doc);\n if (controllersForDoc) {\n controllersForDoc.forEach(controller => {\n controller.dispatchEvent({ type: isKeyboardEvent ? Events.EVENT_KEYBOARD_FOCUS : Events.EVENT_MOUSE_FOCUS });\n });\n }\n }\n init() {\n const clearFocusedCellListener = this.clearFocusedCell.bind(this);\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, clearFocusedCellListener);\n this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onColumnEverythingChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, clearFocusedCellListener);\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, clearFocusedCellListener);\n this.ctrlsService.whenReady(p => {\n this.gridCtrl = p.gridCtrl;\n const doc = this.gridOptionsService.getDocument();\n FocusService_1.addKeyboardModeEvents(doc, this.gridCtrl);\n this.addDestroyFunc(() => this.unregisterGridCompController(this.gridCtrl));\n });\n }\n unregisterGridCompController(gridCompController) {\n const doc = this.gridOptionsService.getDocument();\n FocusService_1.removeKeyboardModeEvents(doc, gridCompController);\n }\n onColumnEverythingChanged() {\n // if the columns change, check and see if this column still exists. if it does, then\n // we can keep the focused cell. if it doesn't, then we need to drop the focused cell.\n if (!this.focusedCellPosition) {\n return;\n }\n const col = this.focusedCellPosition.column;\n const colFromColumnModel = this.columnModel.getGridColumn(col.getId());\n if (col !== colFromColumnModel) {\n this.clearFocusedCell();\n }\n }\n isKeyboardMode() {\n return FocusService_1.keyboardModeActive;\n }\n // we check if the browser is focusing something, and if it is, and\n // it's the cell we think is focused, then return the cell. so this\n // methods returns the cell if a) we think it has focus and b) the\n // browser thinks it has focus. this then returns nothing if we\n // first focus a cell, then second click outside the grid, as then the\n // grid cell will still be focused as far as the grid is concerned,\n // however the browser focus will have moved somewhere else.\n getFocusCellToUseAfterRefresh() {\n const eDocument = this.gridOptionsService.getDocument();\n if (this.gridOptionsService.is('suppressFocusAfterRefresh') || !this.focusedCellPosition) {\n return null;\n }\n // we check that the browser is actually focusing on the grid, if it is not, then\n // we have nothing to worry about. we check for ROW data, as this covers both focused Rows (for Full Width Rows)\n // and Cells (covers cells as cells live in rows)\n if (this.isDomDataMissingInHierarchy(eDocument.activeElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL)) {\n return null;\n }\n return this.focusedCellPosition;\n }\n getFocusHeaderToUseAfterRefresh() {\n const eDocument = this.gridOptionsService.getDocument();\n if (this.gridOptionsService.is('suppressFocusAfterRefresh') || !this.focusedHeaderPosition) {\n return null;\n }\n // we check that the browser is actually focusing on the grid, if it is not, then\n // we have nothing to worry about\n if (this.isDomDataMissingInHierarchy(eDocument.activeElement, AbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL)) {\n return null;\n }\n return this.focusedHeaderPosition;\n }\n isDomDataMissingInHierarchy(eBrowserCell, key) {\n let ePointer = eBrowserCell;\n while (ePointer) {\n const data = this.gridOptionsService.getDomData(ePointer, key);\n if (data) {\n return false;\n }\n ePointer = ePointer.parentNode;\n }\n return true;\n }\n getFocusedCell() {\n return this.focusedCellPosition;\n }\n shouldRestoreFocus(cell) {\n if (this.isCellRestoreFocused(cell)) {\n setTimeout(() => {\n // Clear the restore focused cell position after the timeout to avoid\n // the cell being focused again and stealing focus from another part of the app.\n this.restoredFocusedCellPosition = null;\n }, 0);\n return true;\n }\n return false;\n }\n isCellRestoreFocused(cellPosition) {\n if (this.restoredFocusedCellPosition == null) {\n return false;\n }\n return this.cellPositionUtils.equals(cellPosition, this.restoredFocusedCellPosition);\n }\n setRestoreFocusedCell(cellPosition) {\n if (this.getFrameworkOverrides().renderingEngine === 'react') {\n // The restoredFocusedCellPosition is used in the React Rendering engine as we have to be able\n // to support restoring focus after an async rendering.\n this.restoredFocusedCellPosition = cellPosition;\n }\n }\n getFocusEventParams() {\n const { rowIndex, rowPinned, column } = this.focusedCellPosition;\n const params = {\n rowIndex: rowIndex,\n rowPinned: rowPinned,\n column: column,\n isFullWidthCell: false\n };\n const rowCtrl = this.rowRenderer.getRowByPosition({ rowIndex, rowPinned });\n if (rowCtrl) {\n params.isFullWidthCell = rowCtrl.isFullWidth();\n }\n return params;\n }\n clearFocusedCell() {\n this.restoredFocusedCellPosition = null;\n if (this.focusedCellPosition == null) {\n return;\n }\n const event = Object.assign({ type: Events.EVENT_CELL_FOCUS_CLEARED }, this.getFocusEventParams());\n this.focusedCellPosition = null;\n this.eventService.dispatchEvent(event);\n }\n setFocusedCell(params) {\n const { column, rowIndex, rowPinned, forceBrowserFocus = false, preventScrollOnBrowserFocus = false } = params;\n const gridColumn = this.columnModel.getGridColumn(column);\n // if column doesn't exist, then blank the focused cell and return. this can happen when user sets new columns,\n // and the focused cell is in a column that no longer exists. after columns change, the grid refreshes and tries\n // to re-focus the focused cell.\n if (!gridColumn) {\n this.focusedCellPosition = null;\n return;\n }\n this.focusedCellPosition = gridColumn ? {\n rowIndex: rowIndex,\n rowPinned: makeNull(rowPinned),\n column: gridColumn\n } : null;\n const event = Object.assign(Object.assign({ type: Events.EVENT_CELL_FOCUSED }, this.getFocusEventParams()), { forceBrowserFocus,\n preventScrollOnBrowserFocus, floating: null });\n this.eventService.dispatchEvent(event);\n }\n isCellFocused(cellPosition) {\n if (this.focusedCellPosition == null) {\n return false;\n }\n return this.cellPositionUtils.equals(cellPosition, this.focusedCellPosition);\n }\n isRowNodeFocused(rowNode) {\n return this.isRowFocused(rowNode.rowIndex, rowNode.rowPinned);\n }\n isHeaderWrapperFocused(headerCtrl) {\n if (this.focusedHeaderPosition == null) {\n return false;\n }\n const column = headerCtrl.getColumnGroupChild();\n const headerRowIndex = headerCtrl.getRowIndex();\n const pinned = headerCtrl.getPinned();\n const { column: focusedColumn, headerRowIndex: focusedHeaderRowIndex } = this.focusedHeaderPosition;\n return column === focusedColumn &&\n headerRowIndex === focusedHeaderRowIndex &&\n pinned == focusedColumn.getPinned();\n }\n clearFocusedHeader() {\n this.focusedHeaderPosition = null;\n }\n getFocusedHeader() {\n return this.focusedHeaderPosition;\n }\n setFocusedHeader(headerRowIndex, column) {\n this.focusedHeaderPosition = { headerRowIndex, column };\n }\n focusHeaderPosition(params) {\n const { direction, fromTab, allowUserOverride, event, fromCell } = params;\n let { headerPosition } = params;\n if (fromCell && this.filterManager.isAdvancedFilterHeaderActive()) {\n return this.focusAdvancedFilter(headerPosition);\n }\n if (allowUserOverride) {\n const currentPosition = this.getFocusedHeader();\n const headerRowCount = this.headerNavigationService.getHeaderRowCount();\n if (fromTab) {\n const userFunc = this.gridOptionsService.getCallback('tabToNextHeader');\n if (userFunc) {\n const params = {\n backwards: direction === 'Before',\n previousHeaderPosition: currentPosition,\n nextHeaderPosition: headerPosition,\n headerRowCount,\n };\n headerPosition = userFunc(params);\n }\n }\n else {\n const userFunc = this.gridOptionsService.getCallback('navigateToNextHeader');\n if (userFunc && event) {\n const params = {\n key: event.key,\n previousHeaderPosition: currentPosition,\n nextHeaderPosition: headerPosition,\n headerRowCount,\n event,\n };\n headerPosition = userFunc(params);\n }\n }\n }\n if (!headerPosition) {\n return false;\n }\n if (headerPosition.headerRowIndex === -1) {\n if (this.filterManager.isAdvancedFilterHeaderActive()) {\n return this.focusAdvancedFilter(headerPosition);\n }\n else {\n return this.focusGridView(headerPosition.column);\n }\n }\n this.headerNavigationService.scrollToColumn(headerPosition.column, direction);\n const headerRowContainerCtrl = this.ctrlsService.getHeaderRowContainerCtrl(headerPosition.column.getPinned());\n // this will automatically call the setFocusedHeader method above\n const focusSuccess = headerRowContainerCtrl.focusHeader(headerPosition.headerRowIndex, headerPosition.column, event);\n return focusSuccess;\n }\n focusFirstHeader() {\n let firstColumn = this.columnModel.getAllDisplayedColumns()[0];\n if (!firstColumn) {\n return false;\n }\n if (firstColumn.getParent()) {\n firstColumn = this.columnModel.getColumnGroupAtLevel(firstColumn, 0);\n }\n return this.focusHeaderPosition({\n headerPosition: { headerRowIndex: 0, column: firstColumn }\n });\n }\n focusLastHeader(event) {\n const headerRowIndex = this.headerNavigationService.getHeaderRowCount() - 1;\n const column = last(this.columnModel.getAllDisplayedColumns());\n return this.focusHeaderPosition({\n headerPosition: { headerRowIndex, column },\n event\n });\n }\n focusPreviousFromFirstCell(event) {\n if (this.filterManager.isAdvancedFilterHeaderActive()) {\n return this.focusAdvancedFilter(null);\n }\n else {\n return this.focusLastHeader(event);\n }\n }\n isAnyCellFocused() {\n return !!this.focusedCellPosition;\n }\n isRowFocused(rowIndex, floating) {\n if (this.focusedCellPosition == null) {\n return false;\n }\n return this.focusedCellPosition.rowIndex === rowIndex && this.focusedCellPosition.rowPinned === makeNull(floating);\n }\n findFocusableElements(rootNode, exclude, onlyUnmanaged = false) {\n const focusableString = FOCUSABLE_SELECTOR;\n let excludeString = FOCUSABLE_EXCLUDE;\n if (exclude) {\n excludeString += ', ' + exclude;\n }\n if (onlyUnmanaged) {\n excludeString += ', [tabindex=\"-1\"]';\n }\n const nodes = Array.prototype.slice.apply(rootNode.querySelectorAll(focusableString));\n const excludeNodes = Array.prototype.slice.apply(rootNode.querySelectorAll(excludeString));\n if (!excludeNodes.length) {\n return nodes;\n }\n const diff = (a, b) => a.filter(element => b.indexOf(element) === -1);\n return diff(nodes, excludeNodes);\n }\n focusInto(rootNode, up = false, onlyUnmanaged = false) {\n const focusableElements = this.findFocusableElements(rootNode, null, onlyUnmanaged);\n const toFocus = up ? last(focusableElements) : focusableElements[0];\n if (toFocus) {\n toFocus.focus({ preventScroll: true });\n return true;\n }\n return false;\n }\n findFocusableElementBeforeTabGuard(rootNode, referenceElement) {\n if (!referenceElement) {\n return null;\n }\n const focusableElements = this.findFocusableElements(rootNode);\n const referenceIndex = focusableElements.indexOf(referenceElement);\n if (referenceIndex === -1) {\n return null;\n }\n let lastTabGuardIndex = -1;\n for (let i = referenceIndex - 1; i >= 0; i--) {\n if (focusableElements[i].classList.contains(TabGuardClassNames.TAB_GUARD_TOP)) {\n lastTabGuardIndex = i;\n break;\n }\n }\n if (lastTabGuardIndex <= 0) {\n return null;\n }\n return focusableElements[lastTabGuardIndex - 1];\n }\n findNextFocusableElement(rootNode = this.eGridDiv, onlyManaged, backwards) {\n const focusable = this.findFocusableElements(rootNode, onlyManaged ? ':not([tabindex=\"-1\"])' : null);\n const eDocument = this.gridOptionsService.getDocument();\n const activeEl = eDocument.activeElement;\n let currentIndex;\n if (onlyManaged) {\n currentIndex = focusable.findIndex(el => el.contains(activeEl));\n }\n else {\n currentIndex = focusable.indexOf(activeEl);\n }\n const nextIndex = currentIndex + (backwards ? -1 : 1);\n if (nextIndex < 0 || nextIndex >= focusable.length) {\n return null;\n }\n return focusable[nextIndex];\n }\n isTargetUnderManagedComponent(rootNode, target) {\n if (!target) {\n return false;\n }\n const managedContainers = rootNode.querySelectorAll(`.${ManagedFocusFeature.FOCUS_MANAGED_CLASS}`);\n if (!managedContainers.length) {\n return false;\n }\n for (let i = 0; i < managedContainers.length; i++) {\n if (managedContainers[i].contains(target)) {\n return true;\n }\n }\n return false;\n }\n findTabbableParent(node, limit = 5) {\n let counter = 0;\n while (node && getTabIndex(node) === null && ++counter <= limit) {\n node = node.parentElement;\n }\n if (getTabIndex(node) === null) {\n return null;\n }\n return node;\n }\n focusGridView(column, backwards) {\n // if suppressCellFocus is `true`, it means the user does not want to\n // navigate between the cells using tab. Instead, we put focus on either\n // the header or after the grid, depending on whether tab or shift-tab was pressed.\n if (this.gridOptionsService.is('suppressCellFocus')) {\n if (backwards) {\n return this.focusLastHeader();\n }\n return this.focusNextGridCoreContainer(false);\n }\n const nextRow = backwards\n ? this.rowPositionUtils.getLastRow()\n : this.rowPositionUtils.getFirstRow();\n if (!nextRow) {\n return false;\n }\n const { rowIndex, rowPinned } = nextRow;\n const focusedHeader = this.getFocusedHeader();\n if (!column && focusedHeader) {\n column = focusedHeader.column;\n }\n if (rowIndex == null || !column) {\n return false;\n }\n this.navigationService.ensureCellVisible({ rowIndex, column, rowPinned });\n this.setFocusedCell({\n rowIndex,\n column,\n rowPinned: makeNull(rowPinned),\n forceBrowserFocus: true\n });\n if (this.rangeService) {\n const cellPosition = { rowIndex, rowPinned, column };\n this.rangeService.setRangeToCell(cellPosition);\n }\n return true;\n }\n focusNextGridCoreContainer(backwards, forceOut = false) {\n if (!forceOut && this.gridCtrl.focusNextInnerContainer(backwards)) {\n return true;\n }\n if (forceOut || (!backwards && !this.gridCtrl.isDetailGrid())) {\n this.gridCtrl.forceFocusOutOfContainer(backwards);\n }\n return false;\n }\n focusAdvancedFilter(position) {\n this.advancedFilterFocusColumn = position === null || position === void 0 ? void 0 : position.column;\n return this.advancedFilterService.getCtrl().focusHeaderComp();\n }\n focusNextFromAdvancedFilter(backwards, forceFirstColumn) {\n var _a, _b;\n const column = (_a = (forceFirstColumn ? undefined : this.advancedFilterFocusColumn)) !== null && _a !== void 0 ? _a : (_b = this.columnModel.getAllDisplayedColumns()) === null || _b === void 0 ? void 0 : _b[0];\n if (backwards) {\n return this.focusHeaderPosition({\n headerPosition: {\n column: column,\n headerRowIndex: this.headerNavigationService.getHeaderRowCount() - 1\n }\n });\n }\n else {\n return this.focusGridView(column);\n }\n }\n clearAdvancedFilterColumn() {\n this.advancedFilterFocusColumn = undefined;\n }\n};\nFocusService.AG_KEYBOARD_FOCUS = 'ag-keyboard-focus';\nFocusService.keyboardModeActive = false;\nFocusService.instancesMonitored = new Map();\n__decorate([\n Autowired('eGridDiv')\n], FocusService.prototype, \"eGridDiv\", void 0);\n__decorate([\n Autowired('columnModel')\n], FocusService.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('headerNavigationService')\n], FocusService.prototype, \"headerNavigationService\", void 0);\n__decorate([\n Autowired('rowRenderer')\n], FocusService.prototype, \"rowRenderer\", void 0);\n__decorate([\n Autowired('rowPositionUtils')\n], FocusService.prototype, \"rowPositionUtils\", void 0);\n__decorate([\n Autowired('cellPositionUtils')\n], FocusService.prototype, \"cellPositionUtils\", void 0);\n__decorate([\n Optional('rangeService')\n], FocusService.prototype, \"rangeService\", void 0);\n__decorate([\n Autowired('navigationService')\n], FocusService.prototype, \"navigationService\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], FocusService.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('filterManager')\n], FocusService.prototype, \"filterManager\", void 0);\n__decorate([\n Optional('advancedFilterService')\n], FocusService.prototype, \"advancedFilterService\", void 0);\n__decorate([\n PostConstruct\n], FocusService.prototype, \"init\", null);\nFocusService = FocusService_1 = __decorate([\n Bean('focusService')\n], FocusService);\nexport { FocusService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { KeyCode } from '../../../constants/keyCode.mjs';\nimport { Autowired, PreDestroy } from \"../../../context/context.mjs\";\nimport { DragAndDropService, DragSourceType } from \"../../../dragAndDrop/dragAndDropService.mjs\";\nimport { Column } from \"../../../entities/column.mjs\";\nimport { Events } from \"../../../eventKeys.mjs\";\nimport { SetLeftFeature } from \"../../../rendering/features/setLeftFeature.mjs\";\nimport { getAriaSortState } from \"../../../utils/aria.mjs\";\nimport { ManagedFocusFeature } from \"../../../widgets/managedFocusFeature.mjs\";\nimport { TooltipFeature } from \"../../../widgets/tooltipFeature.mjs\";\nimport { AbstractHeaderCellCtrl } from \"../abstractCell/abstractHeaderCellCtrl.mjs\";\nimport { CssClassApplier } from \"../cssClassApplier.mjs\";\nimport { HoverFeature } from \"../hoverFeature.mjs\";\nimport { ResizeFeature } from \"./resizeFeature.mjs\";\nimport { SelectAllFeature } from \"./selectAllFeature.mjs\";\nimport { getElementSize } from \"../../../utils/dom.mjs\";\nimport { isBrowserSafari } from \"../../../utils/browser.mjs\";\nimport { FocusService } from \"../../../focusService.mjs\";\nexport class HeaderCellCtrl extends AbstractHeaderCellCtrl {\n constructor(column, parentRowCtrl) {\n super(column, parentRowCtrl);\n this.refreshFunctions = [];\n this.userHeaderClasses = new Set();\n this.ariaDescriptionProperties = new Map();\n this.column = column;\n }\n setComp(comp, eGui, eResize, eHeaderCompWrapper) {\n super.setGui(eGui);\n this.comp = comp;\n this.updateState();\n this.setupWidth();\n this.setupMovingCss();\n this.setupMenuClass();\n this.setupSortableClass();\n this.setupWrapTextClass();\n this.refreshSpanHeaderHeight();\n this.setupAutoHeight(eHeaderCompWrapper);\n this.addColumnHoverListener();\n this.setupFilterCss();\n this.setupClassesFromColDef();\n this.setupTooltip();\n this.addActiveHeaderMouseListeners();\n this.setupSelectAll();\n this.setupUserComp();\n this.refreshAria();\n this.createManagedBean(new ResizeFeature(this.getPinned(), this.column, eResize, comp, this));\n this.createManagedBean(new HoverFeature([this.column], eGui));\n this.createManagedBean(new SetLeftFeature(this.column, eGui, this.beans));\n this.createManagedBean(new ManagedFocusFeature(eGui, {\n shouldStopEventPropagation: e => this.shouldStopEventPropagation(e),\n onTabKeyDown: () => null,\n handleKeyDown: this.handleKeyDown.bind(this),\n onFocusIn: this.onFocusIn.bind(this),\n onFocusOut: this.onFocusOut.bind(this)\n }));\n this.addMouseDownListenerIfNeeded(eGui);\n this.addManagedListener(this.column, Column.EVENT_COL_DEF_CHANGED, this.onColDefChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, this.onColumnValueChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.onColumnRowGroupChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_CHANGED, this.onColumnPivotChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_HEADER_HEIGHT_CHANGED, this.onHeaderHeightChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onHeaderHeightChanged.bind(this));\n }\n addMouseDownListenerIfNeeded(eGui) {\n // we add a preventDefault in the DragService for Safari only\n // so we need to make sure we don't prevent focus on mousedown\n if (!isBrowserSafari()) {\n return;\n }\n const events = ['mousedown', 'touchstart'];\n const eDocument = this.gridOptionsService.getDocument();\n events.forEach(eventName => {\n this.addManagedListener(eGui, eventName, (e) => {\n const activeEl = eDocument.activeElement;\n if (activeEl !== eGui && !eGui.contains(activeEl)) {\n eGui.focus();\n FocusService.toggleKeyboardMode(e);\n }\n });\n });\n }\n setupUserComp() {\n const compDetails = this.lookupUserCompDetails();\n this.setCompDetails(compDetails);\n }\n setCompDetails(compDetails) {\n this.userCompDetails = compDetails;\n this.comp.setUserCompDetails(compDetails);\n }\n lookupUserCompDetails() {\n const params = this.createParams();\n const colDef = this.column.getColDef();\n return this.userComponentFactory.getHeaderCompDetails(colDef, params);\n }\n createParams() {\n const colDef = this.column.getColDef();\n const params = {\n column: this.column,\n displayName: this.displayName,\n enableSorting: colDef.sortable,\n enableMenu: this.menuEnabled,\n showColumnMenu: (source) => {\n this.gridApi.showColumnMenuAfterButtonClick(this.column, source);\n },\n progressSort: (multiSort) => {\n this.sortController.progressSort(this.column, !!multiSort, \"uiColumnSorted\");\n },\n setSort: (sort, multiSort) => {\n this.sortController.setSortForColumn(this.column, sort, !!multiSort, \"uiColumnSorted\");\n },\n api: this.gridApi,\n columnApi: this.columnApi,\n context: this.gridOptionsService.context,\n eGridHeader: this.getGui()\n };\n return params;\n }\n setupSelectAll() {\n this.selectAllFeature = this.createManagedBean(new SelectAllFeature(this.column));\n this.selectAllFeature.setComp(this);\n }\n getSelectAllGui() {\n return this.selectAllFeature.getCheckboxGui();\n }\n handleKeyDown(e) {\n super.handleKeyDown(e);\n if (e.key === KeyCode.SPACE) {\n this.selectAllFeature.onSpaceKeyDown(e);\n }\n if (e.key === KeyCode.ENTER) {\n this.onEnterKeyDown(e);\n }\n }\n onEnterKeyDown(e) {\n /// THIS IS BAD - we are assuming the header is not a user provided comp\n const headerComp = this.comp.getUserCompInstance();\n if (!headerComp) {\n return;\n }\n if (e.ctrlKey || e.metaKey) {\n if (this.menuEnabled && headerComp.showMenu) {\n e.preventDefault();\n headerComp.showMenu();\n }\n }\n else if (this.sortable) {\n const multiSort = e.shiftKey;\n this.sortController.progressSort(this.column, multiSort, \"uiColumnSorted\");\n }\n }\n isMenuEnabled() {\n return this.menuEnabled;\n }\n onFocusIn(e) {\n if (!this.getGui().contains(e.relatedTarget)) {\n const rowIndex = this.getRowIndex();\n this.focusService.setFocusedHeader(rowIndex, this.column);\n }\n this.setActiveHeader(true);\n }\n onFocusOut(e) {\n if (this.getGui().contains(e.relatedTarget)) {\n return;\n }\n this.setActiveHeader(false);\n }\n setupTooltip() {\n const tooltipCtrl = {\n getColumn: () => this.column,\n getColDef: () => this.column.getColDef(),\n getGui: () => this.eGui,\n getLocation: () => 'header',\n getTooltipValue: () => {\n const res = this.column.getColDef().headerTooltip;\n return res;\n },\n };\n const tooltipFeature = this.createManagedBean(new TooltipFeature(tooltipCtrl, this.beans));\n tooltipFeature.setComp(this.eGui);\n this.refreshFunctions.push(() => tooltipFeature.refreshToolTip());\n }\n setupClassesFromColDef() {\n const refreshHeaderClasses = () => {\n const colDef = this.column.getColDef();\n const classes = CssClassApplier.getHeaderClassesFromColDef(colDef, this.gridOptionsService, this.column, null);\n const oldClasses = this.userHeaderClasses;\n this.userHeaderClasses = new Set(classes);\n classes.forEach(c => {\n if (oldClasses.has(c)) {\n // class already added, no need to apply it, but remove from old set\n oldClasses.delete(c);\n }\n else {\n // class new since last time, so apply it\n this.comp.addOrRemoveCssClass(c, true);\n }\n });\n // now old set only has classes that were applied last time, but not this time, so remove them\n oldClasses.forEach(c => this.comp.addOrRemoveCssClass(c, false));\n };\n this.refreshFunctions.push(refreshHeaderClasses);\n refreshHeaderClasses();\n }\n setDragSource(eSource) {\n this.dragSourceElement = eSource;\n this.removeDragSource();\n if (!eSource) {\n return;\n }\n if (!this.draggable) {\n return;\n }\n const hideColumnOnExit = !this.gridOptionsService.is('suppressDragLeaveHidesColumns');\n this.moveDragSource = {\n type: DragSourceType.HeaderCell,\n eElement: eSource,\n defaultIconName: hideColumnOnExit ? DragAndDropService.ICON_HIDE : DragAndDropService.ICON_NOT_ALLOWED,\n getDragItem: () => this.createDragItem(),\n dragItemName: this.displayName,\n onDragStarted: () => this.column.setMoving(true, \"uiColumnMoved\"),\n onDragStopped: () => this.column.setMoving(false, \"uiColumnMoved\"),\n onGridEnter: (dragItem) => {\n var _a;\n if (hideColumnOnExit) {\n const unlockedColumns = ((_a = dragItem === null || dragItem === void 0 ? void 0 : dragItem.columns) === null || _a === void 0 ? void 0 : _a.filter(col => !col.getColDef().lockVisible)) || [];\n this.columnModel.setColumnsVisible(unlockedColumns, true, \"uiColumnMoved\");\n }\n },\n onGridExit: (dragItem) => {\n var _a;\n if (hideColumnOnExit) {\n const unlockedColumns = ((_a = dragItem === null || dragItem === void 0 ? void 0 : dragItem.columns) === null || _a === void 0 ? void 0 : _a.filter(col => !col.getColDef().lockVisible)) || [];\n this.columnModel.setColumnsVisible(unlockedColumns, false, \"uiColumnMoved\");\n }\n },\n };\n this.dragAndDropService.addDragSource(this.moveDragSource, true);\n }\n createDragItem() {\n const visibleState = {};\n visibleState[this.column.getId()] = this.column.isVisible();\n return {\n columns: [this.column],\n visibleState: visibleState\n };\n }\n removeDragSource() {\n if (this.moveDragSource) {\n this.dragAndDropService.removeDragSource(this.moveDragSource);\n this.moveDragSource = undefined;\n }\n }\n onColDefChanged() {\n this.refresh();\n }\n updateState() {\n const colDef = this.column.getColDef();\n this.menuEnabled = this.menuFactory.isMenuEnabled(this.column) && !colDef.suppressMenu;\n this.sortable = colDef.sortable;\n this.displayName = this.calculateDisplayName();\n this.draggable = this.workOutDraggable();\n }\n addRefreshFunction(func) {\n this.refreshFunctions.push(func);\n }\n refresh() {\n this.updateState();\n this.refreshHeaderComp();\n this.refreshAria();\n this.refreshFunctions.forEach(f => f());\n }\n refreshHeaderComp() {\n const newCompDetails = this.lookupUserCompDetails();\n const compInstance = this.comp.getUserCompInstance();\n // only try refresh if old comp exists adn it is the correct type\n const attemptRefresh = compInstance != null && this.userCompDetails.componentClass == newCompDetails.componentClass;\n const headerCompRefreshed = attemptRefresh ? this.attemptHeaderCompRefresh(newCompDetails.params) : false;\n if (headerCompRefreshed) {\n // we do this as a refresh happens after colDefs change, and it's possible the column has had it's\n // draggable property toggled. no need to call this if not refreshing, as setDragSource is done\n // as part of appendHeaderComp\n this.setDragSource(this.dragSourceElement);\n }\n else {\n this.setCompDetails(newCompDetails);\n }\n }\n attemptHeaderCompRefresh(params) {\n const headerComp = this.comp.getUserCompInstance();\n if (!headerComp) {\n return false;\n }\n // if no refresh method, then we want to replace the headerComp\n if (!headerComp.refresh) {\n return false;\n }\n const res = headerComp.refresh(params);\n return res;\n }\n calculateDisplayName() {\n return this.columnModel.getDisplayNameForColumn(this.column, 'header', true);\n }\n checkDisplayName() {\n // display name can change if aggFunc different, eg sum(Gold) is now max(Gold)\n if (this.displayName !== this.calculateDisplayName()) {\n this.refresh();\n }\n }\n workOutDraggable() {\n const colDef = this.column.getColDef();\n const isSuppressMovableColumns = this.gridOptionsService.is('suppressMovableColumns');\n const colCanMove = !isSuppressMovableColumns && !colDef.suppressMovable && !colDef.lockPosition;\n // we should still be allowed drag the column, even if it can't be moved, if the column\n // can be dragged to a rowGroup or pivot drop zone\n return !!colCanMove || !!colDef.enableRowGroup || !!colDef.enablePivot;\n }\n onColumnRowGroupChanged() {\n this.checkDisplayName();\n }\n onColumnPivotChanged() {\n this.checkDisplayName();\n }\n onColumnValueChanged() {\n this.checkDisplayName();\n }\n setupWidth() {\n const listener = () => {\n const columnWidth = this.column.getActualWidth();\n this.comp.setWidth(`${columnWidth}px`);\n };\n this.addManagedListener(this.column, Column.EVENT_WIDTH_CHANGED, listener);\n listener();\n }\n setupMovingCss() {\n const listener = () => {\n // this is what makes the header go dark when it is been moved (gives impression to\n // user that the column was picked up).\n this.comp.addOrRemoveCssClass('ag-header-cell-moving', this.column.isMoving());\n };\n this.addManagedListener(this.column, Column.EVENT_MOVING_CHANGED, listener);\n listener();\n }\n setupMenuClass() {\n const listener = () => {\n this.comp.addOrRemoveCssClass('ag-column-menu-visible', this.column.isMenuVisible());\n };\n this.addManagedListener(this.column, Column.EVENT_MENU_VISIBLE_CHANGED, listener);\n listener();\n }\n setupSortableClass() {\n const updateSortableCssClass = () => {\n this.comp.addOrRemoveCssClass('ag-header-cell-sortable', !!this.sortable);\n };\n updateSortableCssClass();\n this.addRefreshFunction(updateSortableCssClass);\n this.addManagedListener(this.eventService, Column.EVENT_SORT_CHANGED, this.refreshAriaSort.bind(this));\n }\n setupWrapTextClass() {\n const listener = () => {\n const wrapText = !!this.column.getColDef().wrapHeaderText;\n this.comp.addOrRemoveCssClass('ag-header-cell-wrap-text', wrapText);\n };\n listener();\n this.addRefreshFunction(listener);\n }\n onHeaderHeightChanged() {\n this.refreshSpanHeaderHeight();\n }\n refreshSpanHeaderHeight() {\n const { eGui, column, comp, columnModel, gridOptionsService } = this;\n if (!column.isSpanHeaderHeight()) {\n return;\n }\n const { numberOfParents, isSpanningTotal } = this.getColumnGroupPaddingInfo();\n comp.addOrRemoveCssClass('ag-header-span-height', numberOfParents > 0);\n const headerHeight = columnModel.getColumnHeaderRowHeight();\n if (numberOfParents === 0) {\n // if spanning has stopped then need to reset these values.\n comp.addOrRemoveCssClass('ag-header-span-total', false);\n eGui.style.setProperty('top', `0px`);\n eGui.style.setProperty('height', `${headerHeight}px`);\n return;\n }\n comp.addOrRemoveCssClass('ag-header-span-total', isSpanningTotal);\n const pivotMode = gridOptionsService.is('pivotMode');\n const groupHeaderHeight = pivotMode\n ? columnModel.getPivotGroupHeaderHeight()\n : columnModel.getGroupHeaderHeight();\n const extraHeight = numberOfParents * groupHeaderHeight;\n eGui.style.setProperty('top', `${-extraHeight}px`);\n eGui.style.setProperty('height', `${headerHeight + extraHeight}px`);\n }\n getColumnGroupPaddingInfo() {\n let parent = this.column.getParent();\n if (!parent || !parent.isPadding()) {\n return { numberOfParents: 0, isSpanningTotal: false };\n }\n const numberOfParents = parent.getPaddingLevel() + 1;\n let isSpanningTotal = true;\n while (parent) {\n if (!parent.isPadding()) {\n isSpanningTotal = false;\n break;\n }\n parent = parent.getParent();\n }\n return { numberOfParents, isSpanningTotal };\n }\n setupAutoHeight(wrapperElement) {\n const measureHeight = (timesCalled) => {\n if (!this.isAlive()) {\n return;\n }\n const { paddingTop, paddingBottom, borderBottomWidth, borderTopWidth } = getElementSize(this.getGui());\n const extraHeight = paddingTop + paddingBottom + borderBottomWidth + borderTopWidth;\n const wrapperHeight = wrapperElement.offsetHeight;\n const autoHeight = wrapperHeight + extraHeight;\n if (timesCalled < 5) {\n // if not in doc yet, means framework not yet inserted, so wait for next VM turn,\n // maybe it will be ready next VM turn\n const doc = this.beans.gridOptionsService.getDocument();\n const notYetInDom = !doc || !doc.contains(wrapperElement);\n // this happens in React, where React hasn't put any content in. we say 'possibly'\n // as a) may not be React and b) the cell could be empty anyway\n const possiblyNoContentYet = autoHeight == 0;\n if (notYetInDom || possiblyNoContentYet) {\n this.beans.frameworkOverrides.setTimeout(() => measureHeight(timesCalled + 1), 0);\n return;\n }\n }\n this.columnModel.setColumnHeaderHeight(this.column, autoHeight);\n };\n let isMeasuring = false;\n let stopResizeObserver;\n const checkMeasuring = () => {\n const newValue = this.column.isAutoHeaderHeight();\n if (newValue && !isMeasuring) {\n startMeasuring();\n }\n if (!newValue && isMeasuring) {\n stopMeasuring();\n }\n };\n const startMeasuring = () => {\n isMeasuring = true;\n measureHeight(0);\n this.comp.addOrRemoveCssClass('ag-header-cell-auto-height', true);\n stopResizeObserver = this.resizeObserverService.observeResize(wrapperElement, () => measureHeight(0));\n };\n const stopMeasuring = () => {\n isMeasuring = false;\n if (stopResizeObserver) {\n stopResizeObserver();\n }\n this.comp.addOrRemoveCssClass('ag-header-cell-auto-height', false);\n stopResizeObserver = undefined;\n };\n checkMeasuring();\n this.addDestroyFunc(() => stopMeasuring());\n // In theory we could rely on the resize observer for everything - but since it's debounced\n // it can be a little janky for smooth movement. in this case its better to react to our own events\n // And unfortunately we cant _just_ rely on our own events, since custom components can change whenever\n this.addManagedListener(this.column, Column.EVENT_WIDTH_CHANGED, () => isMeasuring && measureHeight(0));\n // Displaying the sort icon changes the available area for text, so sort changes can affect height\n this.addManagedListener(this.eventService, Column.EVENT_SORT_CHANGED, () => {\n // Rendering changes for sort, happen after the event... not ideal\n if (isMeasuring) {\n this.beans.frameworkOverrides.setTimeout(() => measureHeight(0));\n }\n });\n this.addRefreshFunction(checkMeasuring);\n }\n refreshAriaSort() {\n if (this.sortable) {\n const translate = this.localeService.getLocaleTextFunc();\n const sort = this.sortController.getDisplaySortForColumn(this.column) || null;\n this.comp.setAriaSort(getAriaSortState(sort));\n this.setAriaDescriptionProperty('sort', translate('ariaSortableColumn', 'Press ENTER to sort.'));\n }\n else {\n this.comp.setAriaSort();\n this.setAriaDescriptionProperty('sort', null);\n }\n }\n refreshAriaMenu() {\n if (this.menuEnabled) {\n const translate = this.localeService.getLocaleTextFunc();\n this.setAriaDescriptionProperty('menu', translate('ariaMenuColumn', 'Press CTRL ENTER to open column menu.'));\n }\n else {\n this.setAriaDescriptionProperty('menu', null);\n }\n }\n setAriaDescriptionProperty(property, value) {\n if (value != null) {\n this.ariaDescriptionProperties.set(property, value);\n }\n else {\n this.ariaDescriptionProperties.delete(property);\n }\n }\n refreshAriaDescription() {\n const descriptionArray = Array.from(this.ariaDescriptionProperties.values());\n this.comp.setAriaDescription(descriptionArray.length ? descriptionArray.join(' ') : undefined);\n }\n refreshAria() {\n this.refreshAriaSort();\n this.refreshAriaMenu();\n this.refreshAriaDescription();\n }\n addColumnHoverListener() {\n const listener = () => {\n if (!this.gridOptionsService.is('columnHoverHighlight')) {\n return;\n }\n const isHovered = this.columnHoverService.isHovered(this.column);\n this.comp.addOrRemoveCssClass('ag-column-hover', isHovered);\n };\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, listener);\n listener();\n }\n setupFilterCss() {\n const listener = () => {\n this.comp.addOrRemoveCssClass('ag-header-cell-filtered', this.column.isFilterActive());\n };\n this.addManagedListener(this.column, Column.EVENT_FILTER_ACTIVE_CHANGED, listener);\n listener();\n }\n getColId() {\n return this.column.getColId();\n }\n addActiveHeaderMouseListeners() {\n const listener = (e) => this.setActiveHeader(e.type === 'mouseenter');\n this.addManagedListener(this.getGui(), 'mouseenter', listener);\n this.addManagedListener(this.getGui(), 'mouseleave', listener);\n }\n setActiveHeader(active) {\n this.comp.addOrRemoveCssClass('ag-header-active', active);\n }\n}\n__decorate([\n Autowired('columnModel')\n], HeaderCellCtrl.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('columnHoverService')\n], HeaderCellCtrl.prototype, \"columnHoverService\", void 0);\n__decorate([\n Autowired('sortController')\n], HeaderCellCtrl.prototype, \"sortController\", void 0);\n__decorate([\n Autowired('menuFactory')\n], HeaderCellCtrl.prototype, \"menuFactory\", void 0);\n__decorate([\n Autowired('dragAndDropService')\n], HeaderCellCtrl.prototype, \"dragAndDropService\", void 0);\n__decorate([\n Autowired('resizeObserverService')\n], HeaderCellCtrl.prototype, \"resizeObserverService\", void 0);\n__decorate([\n Autowired('gridApi')\n], HeaderCellCtrl.prototype, \"gridApi\", void 0);\n__decorate([\n Autowired('columnApi')\n], HeaderCellCtrl.prototype, \"columnApi\", void 0);\n__decorate([\n PreDestroy\n], HeaderCellCtrl.prototype, \"removeDragSource\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../../context/beanStub.mjs\";\nimport { Autowired, PostConstruct } from \"../../../context/context.mjs\";\nexport class GroupResizeFeature extends BeanStub {\n constructor(comp, eResize, pinned, columnGroup) {\n super();\n this.eResize = eResize;\n this.comp = comp;\n this.pinned = pinned;\n this.columnGroup = columnGroup;\n }\n postConstruct() {\n if (!this.columnGroup.isResizable()) {\n this.comp.setResizableDisplayed(false);\n return;\n }\n const finishedWithResizeFunc = this.horizontalResizeService.addResizeBar({\n eResizeBar: this.eResize,\n onResizeStart: this.onResizeStart.bind(this),\n onResizing: this.onResizing.bind(this, false),\n onResizeEnd: this.onResizing.bind(this, true)\n });\n this.addDestroyFunc(finishedWithResizeFunc);\n if (!this.gridOptionsService.is('suppressAutoSize')) {\n const skipHeaderOnAutoSize = this.gridOptionsService.is('skipHeaderOnAutoSize');\n this.eResize.addEventListener('dblclick', () => {\n // get list of all the column keys we are responsible for\n const keys = [];\n const leafCols = this.columnGroup.getDisplayedLeafColumns();\n leafCols.forEach((column) => {\n // not all cols in the group may be participating with auto-resize\n if (!column.getColDef().suppressAutoSize) {\n keys.push(column.getColId());\n }\n });\n if (keys.length > 0) {\n this.columnModel.autoSizeColumns({\n columns: keys,\n skipHeader: skipHeaderOnAutoSize,\n stopAtGroup: this.columnGroup,\n source: 'uiColumnResized'\n });\n }\n this.resizeLeafColumnsToFit('uiColumnResized');\n });\n }\n }\n onResizeStart(shiftKey) {\n this.calculateInitialValues();\n let takeFromGroup = null;\n if (shiftKey) {\n takeFromGroup = this.columnModel.getDisplayedGroupAfter(this.columnGroup);\n }\n if (takeFromGroup) {\n const takeFromLeafCols = takeFromGroup.getDisplayedLeafColumns();\n this.resizeTakeFromCols = takeFromLeafCols.filter(col => col.isResizable());\n this.resizeTakeFromStartWidth = 0;\n this.resizeTakeFromCols.forEach(col => this.resizeTakeFromStartWidth += col.getActualWidth());\n this.resizeTakeFromRatios = [];\n this.resizeTakeFromCols.forEach(col => this.resizeTakeFromRatios.push(col.getActualWidth() / this.resizeTakeFromStartWidth));\n }\n else {\n this.resizeTakeFromCols = null;\n this.resizeTakeFromStartWidth = null;\n this.resizeTakeFromRatios = null;\n }\n this.comp.addOrRemoveCssClass('ag-column-resizing', true);\n }\n onResizing(finished, resizeAmount, source = 'uiColumnResized') {\n const resizeAmountNormalised = this.normaliseDragChange(resizeAmount);\n const width = this.resizeStartWidth + resizeAmountNormalised;\n this.resizeColumns(width, source, finished);\n }\n resizeLeafColumnsToFit(source) {\n const preferredSize = this.autoWidthCalculator.getPreferredWidthForColumnGroup(this.columnGroup);\n this.calculateInitialValues();\n if (preferredSize > this.resizeStartWidth) {\n this.resizeColumns(preferredSize, source, true);\n }\n }\n resizeColumns(totalWidth, source, finished = true) {\n const resizeSets = [];\n resizeSets.push({\n columns: this.resizeCols,\n ratios: this.resizeRatios,\n width: totalWidth\n });\n if (this.resizeTakeFromCols) {\n const diff = totalWidth - this.resizeStartWidth;\n resizeSets.push({\n columns: this.resizeTakeFromCols,\n ratios: this.resizeTakeFromRatios,\n width: this.resizeTakeFromStartWidth - diff\n });\n }\n this.columnModel.resizeColumnSets({\n resizeSets,\n finished,\n source: source\n });\n if (finished) {\n this.comp.addOrRemoveCssClass('ag-column-resizing', false);\n }\n }\n calculateInitialValues() {\n const leafCols = this.columnGroup.getDisplayedLeafColumns();\n this.resizeCols = leafCols.filter(col => col.isResizable());\n this.resizeStartWidth = 0;\n this.resizeCols.forEach(col => this.resizeStartWidth += col.getActualWidth());\n this.resizeRatios = [];\n this.resizeCols.forEach(col => this.resizeRatios.push(col.getActualWidth() / this.resizeStartWidth));\n }\n // optionally inverts the drag, depending on pinned and RTL\n // note - this method is duplicated in RenderedHeaderCell - should refactor out?\n normaliseDragChange(dragChange) {\n let result = dragChange;\n if (this.gridOptionsService.is('enableRtl')) {\n // for RTL, dragging left makes the col bigger, except when pinning left\n if (this.pinned !== 'left') {\n result *= -1;\n }\n }\n else if (this.pinned === 'right') {\n // for LTR (ie normal), dragging left makes the col smaller, except when pinning right\n result *= -1;\n }\n return result;\n }\n}\n__decorate([\n Autowired('horizontalResizeService')\n], GroupResizeFeature.prototype, \"horizontalResizeService\", void 0);\n__decorate([\n Autowired('autoWidthCalculator')\n], GroupResizeFeature.prototype, \"autoWidthCalculator\", void 0);\n__decorate([\n Autowired('columnModel')\n], GroupResizeFeature.prototype, \"columnModel\", void 0);\n__decorate([\n PostConstruct\n], GroupResizeFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../../context/beanStub.mjs\";\nimport { PostConstruct } from \"../../../context/context.mjs\";\nimport { ColumnGroup } from \"../../../entities/columnGroup.mjs\";\nexport class GroupWidthFeature extends BeanStub {\n constructor(comp, columnGroup) {\n super();\n // the children can change, we keep destroy functions related to listening to the children here\n this.removeChildListenersFuncs = [];\n this.columnGroup = columnGroup;\n this.comp = comp;\n }\n postConstruct() {\n // we need to listen to changes in child columns, as they impact our width\n this.addListenersToChildrenColumns();\n // the children belonging to this group can change, so we need to add and remove listeners as they change\n this.addManagedListener(this.columnGroup, ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED, this.onDisplayedChildrenChanged.bind(this));\n this.onWidthChanged();\n // the child listeners are not tied to this components life-cycle, as children can get added and removed\n // to the group - hence they are on a different life-cycle. so we must make sure the existing children\n // listeners are removed when we finally get destroyed\n this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this));\n }\n addListenersToChildrenColumns() {\n // first destroy any old listeners\n this.removeListenersOnChildrenColumns();\n // now add new listeners to the new set of children\n const widthChangedListener = this.onWidthChanged.bind(this);\n this.columnGroup.getLeafColumns().forEach(column => {\n column.addEventListener('widthChanged', widthChangedListener);\n column.addEventListener('visibleChanged', widthChangedListener);\n this.removeChildListenersFuncs.push(() => {\n column.removeEventListener('widthChanged', widthChangedListener);\n column.removeEventListener('visibleChanged', widthChangedListener);\n });\n });\n }\n removeListenersOnChildrenColumns() {\n this.removeChildListenersFuncs.forEach(func => func());\n this.removeChildListenersFuncs = [];\n }\n onDisplayedChildrenChanged() {\n this.addListenersToChildrenColumns();\n this.onWidthChanged();\n }\n onWidthChanged() {\n const columnWidth = this.columnGroup.getActualWidth();\n this.comp.setWidth(`${columnWidth}px`);\n this.comp.addOrRemoveCssClass('ag-hidden', columnWidth === 0);\n }\n}\n__decorate([\n PostConstruct\n], GroupWidthFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { KeyCode } from '../../../constants/keyCode.mjs';\nimport { Autowired } from \"../../../context/context.mjs\";\nimport { DragAndDropService, DragSourceType } from \"../../../dragAndDrop/dragAndDropService.mjs\";\nimport { Column } from \"../../../entities/column.mjs\";\nimport { ProvidedColumnGroup } from \"../../../entities/providedColumnGroup.mjs\";\nimport { SetLeftFeature } from \"../../../rendering/features/setLeftFeature.mjs\";\nimport { removeFromArray } from \"../../../utils/array.mjs\";\nimport { ManagedFocusFeature } from \"../../../widgets/managedFocusFeature.mjs\";\nimport { TooltipFeature } from \"../../../widgets/tooltipFeature.mjs\";\nimport { AbstractHeaderCellCtrl } from \"../abstractCell/abstractHeaderCellCtrl.mjs\";\nimport { CssClassApplier } from \"../cssClassApplier.mjs\";\nimport { HoverFeature } from \"../hoverFeature.mjs\";\nimport { GroupResizeFeature } from \"./groupResizeFeature.mjs\";\nimport { GroupWidthFeature } from \"./groupWidthFeature.mjs\";\nexport class HeaderGroupCellCtrl extends AbstractHeaderCellCtrl {\n constructor(columnGroup, parentRowCtrl) {\n super(columnGroup, parentRowCtrl);\n this.columnGroup = columnGroup;\n }\n setComp(comp, eGui, eResize) {\n super.setGui(eGui);\n this.comp = comp;\n this.displayName = this.columnModel.getDisplayNameForColumnGroup(this.columnGroup, 'header');\n this.addClasses();\n this.setupMovingCss();\n this.setupExpandable();\n this.setupTooltip();\n this.setupUserComp();\n const pinned = this.getParentRowCtrl().getPinned();\n const leafCols = this.columnGroup.getProvidedColumnGroup().getLeafColumns();\n this.createManagedBean(new HoverFeature(leafCols, eGui));\n this.createManagedBean(new SetLeftFeature(this.columnGroup, eGui, this.beans));\n this.createManagedBean(new GroupWidthFeature(comp, this.columnGroup));\n this.groupResizeFeature = this.createManagedBean(new GroupResizeFeature(comp, eResize, pinned, this.columnGroup));\n this.createManagedBean(new ManagedFocusFeature(eGui, {\n shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this),\n onTabKeyDown: () => undefined,\n handleKeyDown: this.handleKeyDown.bind(this),\n onFocusIn: this.onFocusIn.bind(this)\n }));\n }\n resizeLeafColumnsToFit(source) {\n // check to avoid throwing when a component has not been setup yet (React 18)\n if (!this.groupResizeFeature) {\n return;\n }\n this.groupResizeFeature.resizeLeafColumnsToFit(source);\n }\n setupUserComp() {\n let displayName = this.displayName;\n const params = {\n displayName: this.displayName,\n columnGroup: this.columnGroup,\n setExpanded: (expanded) => {\n this.columnModel.setColumnGroupOpened(this.columnGroup.getProvidedColumnGroup(), expanded, \"gridInitializing\");\n },\n api: this.gridApi,\n columnApi: this.columnApi,\n context: this.gridOptionsService.context\n };\n if (!displayName) {\n let columnGroup = this.columnGroup;\n const leafCols = columnGroup.getLeafColumns();\n // find the top most column group that represents the same columns. so if we are dragging a group, we also\n // want to visually show the parent groups dragging for the same column set. for example imaging 5 levels\n // of grouping, with each group only containing the next group, and the last group containing three columns,\n // then when you move any group (even the lowest level group) you are in-fact moving all the groups, as all\n // the groups represent the same column set.\n while (columnGroup.getParent() && columnGroup.getParent().getLeafColumns().length === leafCols.length) {\n columnGroup = columnGroup.getParent();\n }\n const colGroupDef = columnGroup.getColGroupDef();\n if (colGroupDef) {\n displayName = colGroupDef.headerName;\n }\n if (!displayName) {\n displayName = leafCols ? this.columnModel.getDisplayNameForColumn(leafCols[0], 'header', true) : '';\n }\n }\n const compDetails = this.userComponentFactory.getHeaderGroupCompDetails(params);\n this.comp.setUserCompDetails(compDetails);\n }\n setupTooltip() {\n const colGroupDef = this.columnGroup.getColGroupDef();\n const tooltipCtrl = {\n getColumn: () => this.columnGroup,\n getGui: () => this.eGui,\n getLocation: () => 'headerGroup',\n getTooltipValue: () => colGroupDef && colGroupDef.headerTooltip\n };\n if (colGroupDef) {\n tooltipCtrl.getColDef = () => colGroupDef;\n }\n const tooltipFeature = this.createManagedBean(new TooltipFeature(tooltipCtrl, this.beans));\n tooltipFeature.setComp(this.eGui);\n }\n setupExpandable() {\n const providedColGroup = this.columnGroup.getProvidedColumnGroup();\n this.refreshExpanded();\n this.addManagedListener(providedColGroup, ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED, this.refreshExpanded.bind(this));\n this.addManagedListener(providedColGroup, ProvidedColumnGroup.EVENT_EXPANDED_CHANGED, this.refreshExpanded.bind(this));\n }\n refreshExpanded() {\n const column = this.columnGroup;\n this.expandable = column.isExpandable();\n const expanded = column.isExpanded();\n if (this.expandable) {\n this.comp.setAriaExpanded(expanded ? 'true' : 'false');\n }\n else {\n this.comp.setAriaExpanded(undefined);\n }\n }\n getColId() {\n return this.columnGroup.getUniqueId();\n }\n addClasses() {\n const colGroupDef = this.columnGroup.getColGroupDef();\n const classes = CssClassApplier.getHeaderClassesFromColDef(colGroupDef, this.gridOptionsService, null, this.columnGroup);\n // having different classes below allows the style to not have a bottom border\n // on the group header, if no group is specified\n if (this.columnGroup.isPadding()) {\n classes.push('ag-header-group-cell-no-group');\n const leafCols = this.columnGroup.getLeafColumns();\n if (leafCols.every(col => col.isSpanHeaderHeight())) {\n classes.push('ag-header-span-height');\n }\n }\n else {\n classes.push('ag-header-group-cell-with-group');\n }\n classes.forEach(c => this.comp.addOrRemoveCssClass(c, true));\n }\n setupMovingCss() {\n const providedColumnGroup = this.columnGroup.getProvidedColumnGroup();\n const leafColumns = providedColumnGroup.getLeafColumns();\n // this function adds or removes the moving css, based on if the col is moving.\n // this is what makes the header go dark when it is been moved (gives impression to\n // user that the column was picked up).\n const listener = () => this.comp.addOrRemoveCssClass('ag-header-cell-moving', this.columnGroup.isMoving());\n leafColumns.forEach(col => {\n this.addManagedListener(col, Column.EVENT_MOVING_CHANGED, listener);\n });\n listener();\n }\n onFocusIn(e) {\n if (!this.eGui.contains(e.relatedTarget)) {\n const rowIndex = this.getRowIndex();\n this.beans.focusService.setFocusedHeader(rowIndex, this.columnGroup);\n }\n }\n handleKeyDown(e) {\n super.handleKeyDown(e);\n const wrapperHasFocus = this.getWrapperHasFocus();\n if (!this.expandable || !wrapperHasFocus) {\n return;\n }\n if (e.key === KeyCode.ENTER) {\n const column = this.columnGroup;\n const newExpandedValue = !column.isExpanded();\n this.columnModel.setColumnGroupOpened(column.getProvidedColumnGroup(), newExpandedValue, \"uiColumnExpanded\");\n }\n }\n // unlike columns, this will only get called once, as we don't react on props on column groups\n // (we will always destroy and recreate this comp if something changes)\n setDragSource(eHeaderGroup) {\n if (this.isSuppressMoving()) {\n return;\n }\n const allLeafColumns = this.columnGroup.getProvidedColumnGroup().getLeafColumns();\n const hideColumnOnExit = !this.gridOptionsService.is('suppressDragLeaveHidesColumns');\n const dragSource = {\n type: DragSourceType.HeaderCell,\n eElement: eHeaderGroup,\n defaultIconName: hideColumnOnExit ? DragAndDropService.ICON_HIDE : DragAndDropService.ICON_NOT_ALLOWED,\n dragItemName: this.displayName,\n // we add in the original group leaf columns, so we move both visible and non-visible items\n getDragItem: this.getDragItemForGroup.bind(this),\n onDragStarted: () => allLeafColumns.forEach(col => col.setMoving(true, \"uiColumnDragged\")),\n onDragStopped: () => allLeafColumns.forEach(col => col.setMoving(false, \"uiColumnDragged\")),\n onGridEnter: (dragItem) => {\n var _a;\n if (hideColumnOnExit) {\n const unlockedColumns = ((_a = dragItem === null || dragItem === void 0 ? void 0 : dragItem.columns) === null || _a === void 0 ? void 0 : _a.filter(col => !col.getColDef().lockVisible)) || [];\n this.columnModel.setColumnsVisible(unlockedColumns, true, \"uiColumnMoved\");\n }\n },\n onGridExit: (dragItem) => {\n var _a;\n if (hideColumnOnExit) {\n const unlockedColumns = ((_a = dragItem === null || dragItem === void 0 ? void 0 : dragItem.columns) === null || _a === void 0 ? void 0 : _a.filter(col => !col.getColDef().lockVisible)) || [];\n this.columnModel.setColumnsVisible(unlockedColumns, false, \"uiColumnMoved\");\n }\n },\n };\n this.dragAndDropService.addDragSource(dragSource, true);\n this.addDestroyFunc(() => this.dragAndDropService.removeDragSource(dragSource));\n }\n // when moving the columns, we want to move all the columns (contained within the DragItem) in this group in one go,\n // and in the order they are currently in the screen.\n getDragItemForGroup() {\n const allColumnsOriginalOrder = this.columnGroup.getProvidedColumnGroup().getLeafColumns();\n // capture visible state, used when re-entering grid to dictate which columns should be visible\n const visibleState = {};\n allColumnsOriginalOrder.forEach(column => visibleState[column.getId()] = column.isVisible());\n const allColumnsCurrentOrder = [];\n this.columnModel.getAllDisplayedColumns().forEach(column => {\n if (allColumnsOriginalOrder.indexOf(column) >= 0) {\n allColumnsCurrentOrder.push(column);\n removeFromArray(allColumnsOriginalOrder, column);\n }\n });\n // we are left with non-visible columns, stick these in at the end\n allColumnsOriginalOrder.forEach(column => allColumnsCurrentOrder.push(column));\n // create and return dragItem\n return {\n columns: allColumnsCurrentOrder,\n visibleState: visibleState\n };\n }\n isSuppressMoving() {\n // if any child is fixed, then don't allow moving\n let childSuppressesMoving = false;\n this.columnGroup.getLeafColumns().forEach((column) => {\n if (column.getColDef().suppressMovable || column.getColDef().lockPosition) {\n childSuppressesMoving = true;\n }\n });\n const result = childSuppressesMoving || this.gridOptionsService.is('suppressMovableColumns');\n return result;\n }\n}\n__decorate([\n Autowired('columnModel')\n], HeaderGroupCellCtrl.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('dragAndDropService')\n], HeaderGroupCellCtrl.prototype, \"dragAndDropService\", void 0);\n__decorate([\n Autowired('gridApi')\n], HeaderGroupCellCtrl.prototype, \"gridApi\", void 0);\n__decorate([\n Autowired('columnApi')\n], HeaderGroupCellCtrl.prototype, \"columnApi\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired, PostConstruct } from \"../../context/context.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nimport { isBrowserSafari } from \"../../utils/browser.mjs\";\nimport { getAllValuesInObject, iterateObject } from \"../../utils/object.mjs\";\nimport { HeaderFilterCellCtrl } from \"../cells/floatingFilter/headerFilterCellCtrl.mjs\";\nimport { HeaderCellCtrl } from \"../cells/column/headerCellCtrl.mjs\";\nimport { HeaderGroupCellCtrl } from \"../cells/columnGroup/headerGroupCellCtrl.mjs\";\nimport { HeaderRowType } from \"./headerRowComp.mjs\";\nimport { values } from \"../../utils/generic.mjs\";\nlet instanceIdSequence = 0;\nexport class HeaderRowCtrl extends BeanStub {\n constructor(rowIndex, pinned, type) {\n super();\n this.instanceId = instanceIdSequence++;\n this.headerCellCtrls = {};\n this.rowIndex = rowIndex;\n this.pinned = pinned;\n this.type = type;\n const typeClass = type == HeaderRowType.COLUMN_GROUP ? `ag-header-row-column-group` :\n type == HeaderRowType.FLOATING_FILTER ? `ag-header-row-column-filter` : `ag-header-row-column`;\n this.headerRowClass = `ag-header-row ${typeClass}`;\n }\n postConstruct() {\n this.isPrintLayout = this.gridOptionsService.isDomLayout('print');\n this.isEnsureDomOrder = this.gridOptionsService.is('ensureDomOrder');\n }\n getInstanceId() {\n return this.instanceId;\n }\n /**\n *\n * @param comp Proxy to the actual component\n * @param initCompState Should the component be initialised with the current state of the controller. Default: true\n */\n setComp(comp, initCompState = true) {\n this.comp = comp;\n if (initCompState) {\n this.onRowHeightChanged();\n this.onVirtualColumnsChanged();\n }\n // width is managed directly regardless of framework and so is not included in initCompState\n this.setWidth();\n this.addEventListeners();\n }\n getHeaderRowClass() {\n return this.headerRowClass;\n }\n getAriaRowIndex() {\n return this.rowIndex + 1;\n }\n getTransform() {\n if (isBrowserSafari()) {\n // fix for a Safari rendering bug that caused the header to flicker above chart panels\n // as you move the mouse over the header\n return 'translateZ(0)';\n }\n }\n addEventListeners() {\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_RESIZED, this.onColumnResized.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_VIRTUAL_COLUMNS_CHANGED, this.onVirtualColumnsChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HEADER_HEIGHT_CHANGED, this.onRowHeightChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_GRID_STYLES_CHANGED, this.onRowHeightChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_ADVANCED_FILTER_ENABLED_CHANGED, this.onRowHeightChanged.bind(this));\n // when print layout changes, it changes what columns are in what section\n this.addManagedPropertyListener('domLayout', this.onDisplayedColumnsChanged.bind(this));\n this.addManagedPropertyListener('ensureDomOrder', (e) => this.isEnsureDomOrder = e.currentValue);\n this.addManagedPropertyListener('headerHeight', this.onRowHeightChanged.bind(this));\n this.addManagedPropertyListener('pivotHeaderHeight', this.onRowHeightChanged.bind(this));\n this.addManagedPropertyListener('groupHeaderHeight', this.onRowHeightChanged.bind(this));\n this.addManagedPropertyListener('pivotGroupHeaderHeight', this.onRowHeightChanged.bind(this));\n this.addManagedPropertyListener('floatingFiltersHeight', this.onRowHeightChanged.bind(this));\n }\n getHeaderCellCtrl(column) {\n return values(this.headerCellCtrls).find(cellCtrl => cellCtrl.getColumnGroupChild() === column);\n }\n onDisplayedColumnsChanged() {\n this.isPrintLayout = this.gridOptionsService.isDomLayout('print');\n this.onVirtualColumnsChanged();\n this.setWidth();\n this.onRowHeightChanged();\n }\n getType() {\n return this.type;\n }\n onColumnResized() {\n this.setWidth();\n }\n setWidth() {\n const width = this.getWidthForRow();\n this.comp.setWidth(`${width}px`);\n }\n getWidthForRow() {\n if (this.isPrintLayout) {\n const pinned = this.pinned != null;\n if (pinned) {\n return 0;\n }\n return this.columnModel.getContainerWidth('right')\n + this.columnModel.getContainerWidth('left')\n + this.columnModel.getContainerWidth(null);\n }\n // if not printing, just return the width as normal\n return this.columnModel.getContainerWidth(this.pinned);\n }\n onRowHeightChanged() {\n var { topOffset, rowHeight } = this.getTopAndHeight();\n this.comp.setTop(topOffset + 'px');\n this.comp.setHeight(rowHeight + 'px');\n }\n getTopAndHeight() {\n let headerRowCount = this.columnModel.getHeaderRowCount();\n const sizes = [];\n let numberOfFloating = 0;\n if (this.filterManager.hasFloatingFilters()) {\n headerRowCount++;\n numberOfFloating = 1;\n }\n const groupHeight = this.columnModel.getColumnGroupHeaderRowHeight();\n const headerHeight = this.columnModel.getColumnHeaderRowHeight();\n const numberOfNonGroups = 1 + numberOfFloating;\n const numberOfGroups = headerRowCount - numberOfNonGroups;\n for (let i = 0; i < numberOfGroups; i++) {\n sizes.push(groupHeight);\n }\n sizes.push(headerHeight);\n for (let i = 0; i < numberOfFloating; i++) {\n sizes.push(this.columnModel.getFloatingFiltersHeight());\n }\n let topOffset = 0;\n for (let i = 0; i < this.rowIndex; i++) {\n topOffset += sizes[i];\n }\n const rowHeight = sizes[this.rowIndex];\n return { topOffset, rowHeight };\n }\n getPinned() {\n return this.pinned;\n }\n getRowIndex() {\n return this.rowIndex;\n }\n onVirtualColumnsChanged() {\n const ctrlsToDisplay = this.getHeaderCtrls();\n const forceOrder = this.isEnsureDomOrder || this.isPrintLayout;\n this.comp.setHeaderCtrls(ctrlsToDisplay, forceOrder);\n }\n getHeaderCtrls() {\n const oldCtrls = this.headerCellCtrls;\n this.headerCellCtrls = {};\n const columns = this.getColumnsInViewport();\n columns.forEach(child => {\n // skip groups that have no displayed children. this can happen when the group is broken,\n // and this section happens to have nothing to display for the open / closed state.\n // (a broken group is one that is split, ie columns in the group have a non-group column\n // in between them)\n if (child.isEmptyGroup()) {\n return;\n }\n const idOfChild = child.getUniqueId();\n // if we already have this cell rendered, do nothing\n let headerCtrl = oldCtrls[idOfChild];\n delete oldCtrls[idOfChild];\n // it's possible there is a new Column with the same ID, but it's for a different Column.\n // this is common with pivoting, where the pivot cols change, but the id's are still pivot_0,\n // pivot_1 etc. so if new col but same ID, need to remove the old col here first as we are\n // about to replace it in the this.headerComps map.\n const forOldColumn = headerCtrl && headerCtrl.getColumnGroupChild() != child;\n if (forOldColumn) {\n this.destroyBean(headerCtrl);\n headerCtrl = undefined;\n }\n if (headerCtrl == null) {\n switch (this.type) {\n case HeaderRowType.FLOATING_FILTER:\n headerCtrl = this.createBean(new HeaderFilterCellCtrl(child, this));\n break;\n case HeaderRowType.COLUMN_GROUP:\n headerCtrl = this.createBean(new HeaderGroupCellCtrl(child, this));\n break;\n default:\n headerCtrl = this.createBean(new HeaderCellCtrl(child, this));\n break;\n }\n }\n this.headerCellCtrls[idOfChild] = headerCtrl;\n });\n // we want to keep columns that are focused, otherwise keyboard navigation breaks\n const isFocusedAndDisplayed = (ctrl) => {\n const isFocused = this.focusService.isHeaderWrapperFocused(ctrl);\n if (!isFocused) {\n return false;\n }\n const isDisplayed = this.columnModel.isDisplayed(ctrl.getColumnGroupChild());\n return isDisplayed;\n };\n iterateObject(oldCtrls, (id, oldCtrl) => {\n const keepCtrl = isFocusedAndDisplayed(oldCtrl);\n if (keepCtrl) {\n this.headerCellCtrls[id] = oldCtrl;\n }\n else {\n this.destroyBean(oldCtrl);\n }\n });\n const ctrlsToDisplay = getAllValuesInObject(this.headerCellCtrls);\n return ctrlsToDisplay;\n }\n getColumnsInViewport() {\n return this.isPrintLayout ? this.getColumnsInViewportPrintLayout() : this.getColumnsInViewportNormalLayout();\n }\n getColumnsInViewportPrintLayout() {\n // for print layout, we add all columns into the center\n if (this.pinned != null) {\n return [];\n }\n let viewportColumns = [];\n const actualDepth = this.getActualDepth();\n ['left', null, 'right'].forEach(pinned => {\n const items = this.columnModel.getVirtualHeaderGroupRow(pinned, actualDepth);\n viewportColumns = viewportColumns.concat(items);\n });\n return viewportColumns;\n }\n getActualDepth() {\n return this.type == HeaderRowType.FLOATING_FILTER ? this.rowIndex - 1 : this.rowIndex;\n }\n getColumnsInViewportNormalLayout() {\n // when in normal layout, we add the columns for that container only\n return this.columnModel.getVirtualHeaderGroupRow(this.pinned, this.getActualDepth());\n }\n focusHeader(column, event) {\n const allCtrls = getAllValuesInObject(this.headerCellCtrls);\n const ctrl = allCtrls.find(ctrl => ctrl.getColumnGroupChild() == column);\n if (!ctrl) {\n return false;\n }\n ctrl.focus(event);\n return true;\n }\n destroy() {\n iterateObject(this.headerCellCtrls, (key, ctrl) => {\n this.destroyBean(ctrl);\n });\n this.headerCellCtrls = {};\n super.destroy();\n }\n}\n__decorate([\n Autowired('columnModel')\n], HeaderRowCtrl.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('focusService')\n], HeaderRowCtrl.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('filterManager')\n], HeaderRowCtrl.prototype, \"filterManager\", void 0);\n__decorate([\n PostConstruct\n], HeaderRowCtrl.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired } from \"../../context/context.mjs\";\nimport { Column } from \"../../entities/column.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nimport { CenterWidthFeature } from \"../../gridBodyComp/centerWidthFeature.mjs\";\nimport { NumberSequence } from \"../../utils/index.mjs\";\nimport { BodyDropTarget } from \"../columnDrag/bodyDropTarget.mjs\";\nimport { HeaderRowType } from \"../row/headerRowComp.mjs\";\nimport { HeaderRowCtrl } from \"../row/headerRowCtrl.mjs\";\nexport class HeaderRowContainerCtrl extends BeanStub {\n constructor(pinned) {\n super();\n this.hidden = false;\n this.includeFloatingFilter = false;\n this.groupsRowCtrls = [];\n this.pinned = pinned;\n }\n setComp(comp, eGui) {\n this.comp = comp;\n this.eViewport = eGui;\n this.setupCenterWidth();\n this.setupPinnedWidth();\n this.setupDragAndDrop(this.eViewport);\n this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.onGridColumnsChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_ADVANCED_FILTER_ENABLED_CHANGED, this.onDisplayedColumnsChanged.bind(this));\n this.ctrlsService.registerHeaderContainer(this, this.pinned);\n if (this.columnModel.isReady()) {\n this.refresh();\n }\n }\n setupDragAndDrop(dropContainer) {\n const bodyDropTarget = new BodyDropTarget(this.pinned, dropContainer);\n this.createManagedBean(bodyDropTarget);\n }\n refresh(keepColumns = false) {\n const sequence = new NumberSequence();\n const focusedHeaderPosition = this.focusService.getFocusHeaderToUseAfterRefresh();\n const refreshColumnGroups = () => {\n const groupRowCount = this.columnModel.getHeaderRowCount() - 1;\n this.groupsRowCtrls = this.destroyBeans(this.groupsRowCtrls);\n for (let i = 0; i < groupRowCount; i++) {\n const ctrl = this.createBean(new HeaderRowCtrl(sequence.next(), this.pinned, HeaderRowType.COLUMN_GROUP));\n this.groupsRowCtrls.push(ctrl);\n }\n };\n const refreshColumns = () => {\n const rowIndex = sequence.next();\n const needNewInstance = !this.hidden && (this.columnsRowCtrl == null || !keepColumns || this.columnsRowCtrl.getRowIndex() !== rowIndex);\n const shouldDestroyInstance = needNewInstance || this.hidden;\n if (shouldDestroyInstance) {\n this.columnsRowCtrl = this.destroyBean(this.columnsRowCtrl);\n }\n if (needNewInstance) {\n this.columnsRowCtrl = this.createBean(new HeaderRowCtrl(rowIndex, this.pinned, HeaderRowType.COLUMN));\n }\n };\n const refreshFilters = () => {\n this.includeFloatingFilter = this.filterManager.hasFloatingFilters() && !this.hidden;\n const destroyPreviousComp = () => {\n this.filtersRowCtrl = this.destroyBean(this.filtersRowCtrl);\n };\n if (!this.includeFloatingFilter) {\n destroyPreviousComp();\n return;\n }\n const rowIndex = sequence.next();\n if (this.filtersRowCtrl) {\n const rowIndexMismatch = this.filtersRowCtrl.getRowIndex() !== rowIndex;\n if (!keepColumns || rowIndexMismatch) {\n destroyPreviousComp();\n }\n }\n if (!this.filtersRowCtrl) {\n this.filtersRowCtrl = this.createBean(new HeaderRowCtrl(rowIndex, this.pinned, HeaderRowType.FLOATING_FILTER));\n }\n };\n refreshColumnGroups();\n refreshColumns();\n refreshFilters();\n const allCtrls = this.getAllCtrls();\n this.comp.setCtrls(allCtrls);\n this.restoreFocusOnHeader(focusedHeaderPosition);\n }\n restoreFocusOnHeader(position) {\n if (position == null || position.column.getPinned() != this.pinned) {\n return;\n }\n this.focusService.focusHeaderPosition({ headerPosition: position });\n }\n getAllCtrls() {\n const res = [...this.groupsRowCtrls];\n if (this.columnsRowCtrl) {\n res.push(this.columnsRowCtrl);\n }\n if (this.filtersRowCtrl) {\n res.push(this.filtersRowCtrl);\n }\n return res;\n }\n // grid cols have changed - this also means the number of rows in the header can have\n // changed. so we remove all the old rows and insert new ones for a complete refresh\n onGridColumnsChanged() {\n this.refresh(true);\n }\n onDisplayedColumnsChanged() {\n const includeFloatingFilter = this.filterManager.hasFloatingFilters() && !this.hidden;\n if (this.includeFloatingFilter !== includeFloatingFilter) {\n this.refresh(true);\n }\n }\n setupCenterWidth() {\n if (this.pinned != null) {\n return;\n }\n this.createManagedBean(new CenterWidthFeature(width => this.comp.setCenterWidth(`${width}px`), true));\n }\n setHorizontalScroll(offset) {\n this.comp.setViewportScrollLeft(offset);\n }\n setupPinnedWidth() {\n if (this.pinned == null) {\n return;\n }\n const pinningLeft = this.pinned === 'left';\n const pinningRight = this.pinned === 'right';\n this.hidden = true;\n const listener = () => {\n const width = pinningLeft ? this.pinnedWidthService.getPinnedLeftWidth() : this.pinnedWidthService.getPinnedRightWidth();\n if (width == null) {\n return;\n } // can happen at initialisation, width not yet set\n const hidden = (width == 0);\n const hiddenChanged = this.hidden !== hidden;\n const isRtl = this.gridOptionsService.is('enableRtl');\n const scrollbarWidth = this.gridOptionsService.getScrollbarWidth();\n // if there is a scroll showing (and taking up space, so Windows, and not iOS)\n // in the body, then we add extra space to keep header aligned with the body,\n // as body width fits the cols and the scrollbar\n const addPaddingForScrollbar = this.scrollVisibleService.isVerticalScrollShowing() && ((isRtl && pinningLeft) || (!isRtl && pinningRight));\n const widthWithPadding = addPaddingForScrollbar ? width + scrollbarWidth : width;\n this.comp.setPinnedContainerWidth(`${widthWithPadding}px`);\n this.comp.setDisplayed(!hidden);\n if (hiddenChanged) {\n this.hidden = hidden;\n this.refresh();\n }\n };\n this.addManagedListener(this.eventService, Events.EVENT_LEFT_PINNED_WIDTH_CHANGED, listener);\n this.addManagedListener(this.eventService, Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED, listener);\n this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, listener);\n this.addManagedListener(this.eventService, Events.EVENT_SCROLLBAR_WIDTH_CHANGED, listener);\n }\n getHeaderCtrlForColumn(column) {\n if (column instanceof Column) {\n if (!this.columnsRowCtrl) {\n return;\n }\n return this.columnsRowCtrl.getHeaderCellCtrl(column);\n }\n if (this.groupsRowCtrls.length === 0) {\n return;\n }\n for (let i = 0; i < this.groupsRowCtrls.length; i++) {\n const ctrl = this.groupsRowCtrls[i].getHeaderCellCtrl(column);\n if (ctrl) {\n return ctrl;\n }\n }\n }\n getHtmlElementForColumnHeader(column) {\n /* tslint:enable */\n const cellCtrl = this.getHeaderCtrlForColumn(column);\n if (!cellCtrl) {\n return null;\n }\n return cellCtrl.getGui();\n }\n getRowType(rowIndex) {\n const allCtrls = this.getAllCtrls();\n const ctrl = allCtrls[rowIndex];\n return ctrl ? ctrl.getType() : undefined;\n }\n focusHeader(rowIndex, column, event) {\n const allCtrls = this.getAllCtrls();\n const ctrl = allCtrls[rowIndex];\n if (!ctrl) {\n return false;\n }\n return ctrl.focusHeader(column, event);\n }\n getRowCount() {\n return this.groupsRowCtrls.length + (this.columnsRowCtrl ? 1 : 0) + (this.filtersRowCtrl ? 1 : 0);\n }\n destroy() {\n if (this.filtersRowCtrl) {\n this.filtersRowCtrl = this.destroyBean(this.filtersRowCtrl);\n }\n if (this.columnsRowCtrl) {\n this.columnsRowCtrl = this.destroyBean(this.columnsRowCtrl);\n }\n if (this.groupsRowCtrls && this.groupsRowCtrls.length) {\n this.groupsRowCtrls = this.destroyBeans(this.groupsRowCtrls);\n }\n super.destroy();\n }\n}\n__decorate([\n Autowired('ctrlsService')\n], HeaderRowContainerCtrl.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('scrollVisibleService')\n], HeaderRowContainerCtrl.prototype, \"scrollVisibleService\", void 0);\n__decorate([\n Autowired('pinnedWidthService')\n], HeaderRowContainerCtrl.prototype, \"pinnedWidthService\", void 0);\n__decorate([\n Autowired('columnModel')\n], HeaderRowContainerCtrl.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('focusService')\n], HeaderRowContainerCtrl.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('filterManager')\n], HeaderRowContainerCtrl.prototype, \"filterManager\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PostConstruct, PreDestroy } from '../../context/context.mjs';\nimport { ensureDomOrder } from '../../utils/dom.mjs';\nimport { getAllValuesInObject } from '../../utils/object.mjs';\nimport { Component } from '../../widgets/component.mjs';\nimport { RefSelector } from '../../widgets/componentAnnotations.mjs';\nimport { HeaderRowComp } from '../row/headerRowComp.mjs';\nimport { HeaderRowContainerCtrl } from './headerRowContainerCtrl.mjs';\nexport class HeaderRowContainerComp extends Component {\n constructor(pinned) {\n super();\n this.headerRowComps = {};\n this.rowCompsList = [];\n this.pinned = pinned;\n }\n init() {\n this.selectAndSetTemplate();\n const compProxy = {\n setDisplayed: displayed => this.setDisplayed(displayed),\n setCtrls: ctrls => this.setCtrls(ctrls),\n // only gets called for center section\n setCenterWidth: width => this.eCenterContainer.style.width = width,\n setViewportScrollLeft: left => this.getGui().scrollLeft = left,\n // only gets called for pinned sections\n setPinnedContainerWidth: width => {\n const eGui = this.getGui();\n eGui.style.width = width;\n eGui.style.maxWidth = width;\n eGui.style.minWidth = width;\n }\n };\n const ctrl = this.createManagedBean(new HeaderRowContainerCtrl(this.pinned));\n ctrl.setComp(compProxy, this.getGui());\n }\n selectAndSetTemplate() {\n const pinnedLeft = this.pinned == 'left';\n const pinnedRight = this.pinned == 'right';\n const template = pinnedLeft ? HeaderRowContainerComp.PINNED_LEFT_TEMPLATE :\n pinnedRight ? HeaderRowContainerComp.PINNED_RIGHT_TEMPLATE : HeaderRowContainerComp.CENTER_TEMPLATE;\n this.setTemplate(template);\n // for left and right, we add rows directly to the root element,\n // but for center container we add elements to the child container.\n this.eRowContainer = this.eCenterContainer ? this.eCenterContainer : this.getGui();\n }\n destroyRowComps() {\n this.setCtrls([]);\n }\n destroyRowComp(rowComp) {\n this.destroyBean(rowComp);\n this.eRowContainer.removeChild(rowComp.getGui());\n }\n setCtrls(ctrls) {\n const oldRowComps = this.headerRowComps;\n this.headerRowComps = {};\n this.rowCompsList = [];\n let prevGui;\n const appendEnsuringDomOrder = (rowComp) => {\n const eGui = rowComp.getGui();\n const notAlreadyIn = eGui.parentElement != this.eRowContainer;\n if (notAlreadyIn) {\n this.eRowContainer.appendChild(eGui);\n }\n if (prevGui) {\n ensureDomOrder(this.eRowContainer, eGui, prevGui);\n }\n prevGui = eGui;\n };\n ctrls.forEach(ctrl => {\n const ctrlId = ctrl.getInstanceId();\n const existingComp = oldRowComps[ctrlId];\n delete oldRowComps[ctrlId];\n const rowComp = existingComp ? existingComp : this.createBean(new HeaderRowComp(ctrl));\n this.headerRowComps[ctrlId] = rowComp;\n this.rowCompsList.push(rowComp);\n appendEnsuringDomOrder(rowComp);\n });\n getAllValuesInObject(oldRowComps).forEach(c => this.destroyRowComp(c));\n }\n}\nHeaderRowContainerComp.PINNED_LEFT_TEMPLATE = `
`;\nHeaderRowContainerComp.PINNED_RIGHT_TEMPLATE = `
`;\nHeaderRowContainerComp.CENTER_TEMPLATE = `
\n
\n
`;\n__decorate([\n RefSelector('eCenterContainer')\n], HeaderRowContainerComp.prototype, \"eCenterContainer\", void 0);\n__decorate([\n PostConstruct\n], HeaderRowContainerComp.prototype, \"init\", null);\n__decorate([\n PreDestroy\n], HeaderRowContainerComp.prototype, \"destroyRowComps\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired, Bean, PostConstruct } from \"../../context/context.mjs\";\nimport { ColumnGroup } from \"../../entities/columnGroup.mjs\";\nimport { last } from \"../../utils/array.mjs\";\nexport var HeaderNavigationDirection;\n(function (HeaderNavigationDirection) {\n HeaderNavigationDirection[HeaderNavigationDirection[\"UP\"] = 0] = \"UP\";\n HeaderNavigationDirection[HeaderNavigationDirection[\"DOWN\"] = 1] = \"DOWN\";\n HeaderNavigationDirection[HeaderNavigationDirection[\"LEFT\"] = 2] = \"LEFT\";\n HeaderNavigationDirection[HeaderNavigationDirection[\"RIGHT\"] = 3] = \"RIGHT\";\n})(HeaderNavigationDirection || (HeaderNavigationDirection = {}));\nlet HeaderNavigationService = class HeaderNavigationService extends BeanStub {\n postConstruct() {\n this.ctrlsService.whenReady(p => {\n this.gridBodyCon = p.gridBodyCtrl;\n });\n }\n getHeaderRowCount() {\n const centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();\n return centerHeaderContainer ? centerHeaderContainer.getRowCount() : 0;\n }\n /*\n * This method navigates grid header vertically\n * @return {boolean} true to preventDefault on the event that caused this navigation.\n */\n navigateVertically(direction, fromHeader, event) {\n if (!fromHeader) {\n fromHeader = this.focusService.getFocusedHeader();\n }\n if (!fromHeader) {\n return false;\n }\n const { headerRowIndex, column } = fromHeader;\n const rowLen = this.getHeaderRowCount();\n const isUp = direction === HeaderNavigationDirection.UP;\n let { nextRow, nextFocusColumn } = isUp\n ? this.headerPositionUtils.getColumnVisibleParent(column, headerRowIndex)\n : this.headerPositionUtils.getColumnVisibleChild(column, headerRowIndex);\n let skipColumn = false;\n if (nextRow < 0) {\n nextRow = 0;\n nextFocusColumn = column;\n skipColumn = true;\n }\n if (nextRow >= rowLen) {\n nextRow = -1; // -1 indicates the focus should move to grid rows.\n }\n if (!skipColumn && !nextFocusColumn) {\n return false;\n }\n return this.focusService.focusHeaderPosition({\n headerPosition: { headerRowIndex: nextRow, column: nextFocusColumn },\n allowUserOverride: true,\n event\n });\n }\n /*\n * This method navigates grid header horizontally\n * @return {boolean} true to preventDefault on the event that caused this navigation.\n */\n navigateHorizontally(direction, fromTab = false, event) {\n const focusedHeader = this.focusService.getFocusedHeader();\n const isLeft = direction === HeaderNavigationDirection.LEFT;\n const isRtl = this.gridOptionsService.is('enableRtl');\n let nextHeader;\n let normalisedDirection;\n // either navigating to the left or isRtl (cannot be both)\n if (isLeft !== isRtl) {\n normalisedDirection = 'Before';\n nextHeader = this.headerPositionUtils.findHeader(focusedHeader, normalisedDirection);\n }\n else {\n normalisedDirection = 'After';\n nextHeader = this.headerPositionUtils.findHeader(focusedHeader, normalisedDirection);\n }\n if (nextHeader || !fromTab) {\n return this.focusService.focusHeaderPosition({\n headerPosition: nextHeader,\n direction: normalisedDirection,\n fromTab,\n allowUserOverride: true,\n event\n });\n }\n return this.focusNextHeaderRow(focusedHeader, normalisedDirection, event);\n }\n focusNextHeaderRow(focusedHeader, direction, event) {\n const currentIndex = focusedHeader.headerRowIndex;\n let nextPosition = null;\n let nextRowIndex;\n if (direction === 'Before') {\n if (currentIndex > 0) {\n nextRowIndex = currentIndex - 1;\n nextPosition = this.headerPositionUtils.findColAtEdgeForHeaderRow(nextRowIndex, 'end');\n }\n }\n else {\n nextRowIndex = currentIndex + 1;\n nextPosition = this.headerPositionUtils.findColAtEdgeForHeaderRow(nextRowIndex, 'start');\n }\n return this.focusService.focusHeaderPosition({\n headerPosition: nextPosition,\n direction,\n fromTab: true,\n allowUserOverride: true,\n event\n });\n }\n scrollToColumn(column, direction = 'After') {\n if (column.getPinned()) {\n return;\n }\n let columnToScrollTo;\n if (column instanceof ColumnGroup) {\n const columns = column.getDisplayedLeafColumns();\n columnToScrollTo = direction === 'Before' ? last(columns) : columns[0];\n }\n else {\n columnToScrollTo = column;\n }\n this.gridBodyCon.getScrollFeature().ensureColumnVisible(columnToScrollTo);\n }\n};\n__decorate([\n Autowired('focusService')\n], HeaderNavigationService.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('headerPositionUtils')\n], HeaderNavigationService.prototype, \"headerPositionUtils\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], HeaderNavigationService.prototype, \"ctrlsService\", void 0);\n__decorate([\n PostConstruct\n], HeaderNavigationService.prototype, \"postConstruct\", null);\nHeaderNavigationService = __decorate([\n Bean('headerNavigationService')\n], HeaderNavigationService);\nexport { HeaderNavigationService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { KeyCode } from \"../constants/keyCode.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Autowired } from \"../context/context.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nimport { ManagedFocusFeature } from \"../widgets/managedFocusFeature.mjs\";\nimport { HeaderNavigationDirection } from \"./common/headerNavigationService.mjs\";\nexport class GridHeaderCtrl extends BeanStub {\n setComp(comp, eGui, eFocusableElement) {\n this.comp = comp;\n this.eGui = eGui;\n this.createManagedBean(new ManagedFocusFeature(eFocusableElement, {\n onTabKeyDown: this.onTabKeyDown.bind(this),\n handleKeyDown: this.handleKeyDown.bind(this),\n onFocusOut: this.onFocusOut.bind(this)\n }));\n // for setting ag-pivot-on / ag-pivot-off CSS classes\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, this.onPivotModeChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));\n this.onPivotModeChanged();\n this.setupHeaderHeight();\n this.ctrlsService.registerGridHeaderCtrl(this);\n }\n setupHeaderHeight() {\n const listener = this.setHeaderHeight.bind(this);\n listener();\n this.addManagedPropertyListener('headerHeight', listener);\n this.addManagedPropertyListener('pivotHeaderHeight', listener);\n this.addManagedPropertyListener('groupHeaderHeight', listener);\n this.addManagedPropertyListener('pivotGroupHeaderHeight', listener);\n this.addManagedPropertyListener('floatingFiltersHeight', listener);\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HEADER_HEIGHT_CHANGED, listener);\n this.addManagedListener(this.eventService, Events.EVENT_GRID_STYLES_CHANGED, listener);\n this.addManagedListener(this.eventService, Events.EVENT_ADVANCED_FILTER_ENABLED_CHANGED, listener);\n }\n getHeaderHeight() {\n return this.headerHeight;\n }\n setHeaderHeight() {\n const { columnModel } = this;\n let numberOfFloating = 0;\n let headerRowCount = columnModel.getHeaderRowCount();\n let totalHeaderHeight;\n const hasFloatingFilters = this.filterManager.hasFloatingFilters();\n if (hasFloatingFilters) {\n headerRowCount++;\n numberOfFloating = 1;\n }\n const groupHeight = this.columnModel.getColumnGroupHeaderRowHeight();\n const headerHeight = this.columnModel.getColumnHeaderRowHeight();\n const numberOfNonGroups = 1 + numberOfFloating;\n const numberOfGroups = headerRowCount - numberOfNonGroups;\n totalHeaderHeight = numberOfFloating * columnModel.getFloatingFiltersHeight();\n totalHeaderHeight += numberOfGroups * groupHeight;\n totalHeaderHeight += headerHeight;\n if (this.headerHeight === totalHeaderHeight) {\n return;\n }\n this.headerHeight = totalHeaderHeight;\n // one extra pixel is needed here to account for the\n // height of the border\n const px = `${totalHeaderHeight + 1}px`;\n this.comp.setHeightAndMinHeight(px);\n this.eventService.dispatchEvent({\n type: Events.EVENT_HEADER_HEIGHT_CHANGED\n });\n }\n onPivotModeChanged() {\n const pivotMode = this.columnModel.isPivotMode();\n this.comp.addOrRemoveCssClass('ag-pivot-on', pivotMode);\n this.comp.addOrRemoveCssClass('ag-pivot-off', !pivotMode);\n }\n onDisplayedColumnsChanged() {\n const columns = this.columnModel.getAllDisplayedColumns();\n const shouldAllowOverflow = columns.some(col => col.isSpanHeaderHeight());\n this.comp.addOrRemoveCssClass('ag-header-allow-overflow', shouldAllowOverflow);\n }\n onTabKeyDown(e) {\n const isRtl = this.gridOptionsService.is('enableRtl');\n const direction = e.shiftKey !== isRtl\n ? HeaderNavigationDirection.LEFT\n : HeaderNavigationDirection.RIGHT;\n if (this.headerNavigationService.navigateHorizontally(direction, true, e) ||\n this.focusService.focusNextGridCoreContainer(e.shiftKey)) {\n e.preventDefault();\n }\n }\n handleKeyDown(e) {\n let direction = null;\n switch (e.key) {\n case KeyCode.LEFT:\n direction = HeaderNavigationDirection.LEFT;\n case KeyCode.RIGHT:\n if (!exists(direction)) {\n direction = HeaderNavigationDirection.RIGHT;\n }\n this.headerNavigationService.navigateHorizontally(direction, false, e);\n break;\n case KeyCode.UP:\n direction = HeaderNavigationDirection.UP;\n case KeyCode.DOWN:\n if (!exists(direction)) {\n direction = HeaderNavigationDirection.DOWN;\n }\n if (this.headerNavigationService.navigateVertically(direction, null, e)) {\n e.preventDefault();\n }\n break;\n default:\n return;\n }\n }\n onFocusOut(e) {\n const eDocument = this.gridOptionsService.getDocument();\n const { relatedTarget } = e;\n if (!relatedTarget && this.eGui.contains(eDocument.activeElement)) {\n return;\n }\n if (!this.eGui.contains(relatedTarget)) {\n this.focusService.clearFocusedHeader();\n }\n }\n}\n__decorate([\n Autowired('headerNavigationService')\n], GridHeaderCtrl.prototype, \"headerNavigationService\", void 0);\n__decorate([\n Autowired('focusService')\n], GridHeaderCtrl.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('columnModel')\n], GridHeaderCtrl.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], GridHeaderCtrl.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('filterManager')\n], GridHeaderCtrl.prototype, \"filterManager\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PostConstruct } from '../context/context.mjs';\nimport { Component } from '../widgets/component.mjs';\nimport { GridHeaderCtrl } from './gridHeaderCtrl.mjs';\nimport { HeaderRowContainerComp } from './rowContainer/headerRowContainerComp.mjs';\nexport class GridHeaderComp extends Component {\n constructor() {\n super(GridHeaderComp.TEMPLATE);\n }\n postConstruct() {\n const compProxy = {\n addOrRemoveCssClass: (cssClassName, on) => this.addOrRemoveCssClass(cssClassName, on),\n setHeightAndMinHeight: height => {\n this.getGui().style.height = height;\n this.getGui().style.minHeight = height;\n }\n };\n const ctrl = this.createManagedBean(new GridHeaderCtrl());\n ctrl.setComp(compProxy, this.getGui(), this.getFocusableElement());\n const addContainer = (container) => {\n this.createManagedBean(container);\n this.appendChild(container);\n };\n addContainer(new HeaderRowContainerComp('left'));\n addContainer(new HeaderRowContainerComp(null));\n addContainer(new HeaderRowContainerComp('right'));\n }\n}\nGridHeaderComp.TEMPLATE = `
`;\n__decorate([\n PostConstruct\n], GridHeaderComp.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean } from \"../../context/context.mjs\";\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nlet HorizontalResizeService = class HorizontalResizeService extends BeanStub {\n addResizeBar(params) {\n const dragSource = {\n dragStartPixels: params.dragStartPixels || 0,\n eElement: params.eResizeBar,\n onDragStart: this.onDragStart.bind(this, params),\n onDragStop: this.onDragStop.bind(this, params),\n onDragging: this.onDragging.bind(this, params),\n includeTouch: true,\n stopPropagationForTouch: true\n };\n this.dragService.addDragSource(dragSource);\n // we pass remove func back to the caller, so call can tell us when they\n // are finished, and then we remove the listener from the drag source\n const finishedWithResizeFunc = () => this.dragService.removeDragSource(dragSource);\n return finishedWithResizeFunc;\n }\n onDragStart(params, mouseEvent) {\n this.dragStartX = mouseEvent.clientX;\n this.setResizeIcons();\n const shiftKey = mouseEvent instanceof MouseEvent && mouseEvent.shiftKey === true;\n params.onResizeStart(shiftKey);\n }\n setResizeIcons() {\n const ctrl = this.ctrlsService.getGridCtrl();\n // change the body cursor, so when drag moves out of the drag bar, the cursor is still 'resize' (or 'move'\n ctrl.setResizeCursor(true);\n // we don't want text selection outside the grid (otherwise it looks weird as text highlights when we move)\n ctrl.disableUserSelect(true);\n }\n onDragStop(params, mouseEvent) {\n params.onResizeEnd(this.resizeAmount);\n this.resetIcons();\n }\n resetIcons() {\n const ctrl = this.ctrlsService.getGridCtrl();\n ctrl.setResizeCursor(false);\n ctrl.disableUserSelect(false);\n }\n onDragging(params, mouseEvent) {\n this.resizeAmount = mouseEvent.clientX - this.dragStartX;\n params.onResizing(this.resizeAmount);\n }\n};\n__decorate([\n Autowired('dragService')\n], HorizontalResizeService.prototype, \"dragService\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], HorizontalResizeService.prototype, \"ctrlsService\", void 0);\nHorizontalResizeService = __decorate([\n Bean('horizontalResizeService')\n], HorizontalResizeService);\nexport { HorizontalResizeService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean } from '../../../context/context.mjs';\nimport { BeanStub } from \"../../../context/beanStub.mjs\";\nimport { isVisible } from '../../../utils/dom.mjs';\nimport { KeyCode } from '../../../constants/keyCode.mjs';\nimport { setAriaRole } from '../../../utils/aria.mjs';\nlet StandardMenuFactory = class StandardMenuFactory extends BeanStub {\n hideActiveMenu() {\n if (this.hidePopup) {\n this.hidePopup();\n }\n }\n showMenuAfterMouseEvent(column, mouseEvent) {\n this.showPopup(column, eMenu => {\n this.popupService.positionPopupUnderMouseEvent({\n column,\n type: 'columnMenu',\n mouseEvent,\n ePopup: eMenu\n });\n }, 'columnMenu', mouseEvent.target);\n }\n showMenuAfterButtonClick(column, eventSource, containerType) {\n this.showPopup(column, eMenu => {\n this.popupService.positionPopupByComponent({\n type: containerType,\n eventSource,\n ePopup: eMenu,\n keepWithinBounds: true,\n position: 'under',\n column,\n });\n }, containerType, eventSource);\n }\n showPopup(column, positionCallback, containerType, eventSource) {\n const filterWrapper = this.filterManager.getOrCreateFilterWrapper(column, 'COLUMN_MENU');\n if (!filterWrapper) {\n throw new Error('AG Grid - unable to show popup filter, filter instantiation failed');\n }\n const eMenu = document.createElement('div');\n setAriaRole(eMenu, 'presentation');\n eMenu.classList.add('ag-menu');\n this.tabListener = this.addManagedListener(eMenu, 'keydown', (e) => this.trapFocusWithin(e, eMenu));\n filterWrapper.guiPromise.then(gui => eMenu.appendChild(gui));\n let hidePopup;\n const afterGuiDetached = () => { var _a; return (_a = filterWrapper.filterPromise) === null || _a === void 0 ? void 0 : _a.then(filter => { var _a; return (_a = filter === null || filter === void 0 ? void 0 : filter.afterGuiDetached) === null || _a === void 0 ? void 0 : _a.call(filter); }); };\n const anchorToElement = eventSource || this.ctrlsService.getGridBodyCtrl().getGui();\n const closedCallback = (e) => {\n column.setMenuVisible(false, 'contextMenu');\n const isKeyboardEvent = e instanceof KeyboardEvent;\n if (this.tabListener) {\n this.tabListener = this.tabListener();\n }\n if (isKeyboardEvent && eventSource && isVisible(eventSource)) {\n const focusableEl = this.focusService.findTabbableParent(eventSource);\n if (focusableEl) {\n focusableEl.focus();\n }\n }\n afterGuiDetached();\n };\n const translate = this.localeService.getLocaleTextFunc();\n const addPopupRes = this.popupService.addPopup({\n modal: true,\n eChild: eMenu,\n closeOnEsc: true,\n closedCallback,\n positionCallback: () => positionCallback(eMenu),\n anchorToElement,\n ariaLabel: translate('ariaLabelColumnMenu', 'Column Menu')\n });\n if (addPopupRes) {\n this.hidePopup = hidePopup = addPopupRes.hideFunc;\n }\n filterWrapper.filterPromise.then(filter => {\n // need to make sure the filter is present before positioning, as only\n // after filter it is visible can we find out what the width of it is\n positionCallback(eMenu);\n if (filter.afterGuiAttached) {\n filter.afterGuiAttached({ container: containerType, hidePopup });\n }\n });\n column.setMenuVisible(true, 'contextMenu');\n }\n trapFocusWithin(e, menu) {\n if (e.key !== KeyCode.TAB ||\n e.defaultPrevented ||\n this.focusService.findNextFocusableElement(menu, false, e.shiftKey)) {\n return;\n }\n e.preventDefault();\n this.focusService.focusInto(menu, e.shiftKey);\n }\n isMenuEnabled(column) {\n // for standard, we show menu if filter is enabled, and the menu is not suppressed by passing an empty array\n return column.isFilterAllowed() && column.getMenuTabs(['filterMenuTab']).includes('filterMenuTab');\n }\n};\n__decorate([\n Autowired('filterManager')\n], StandardMenuFactory.prototype, \"filterManager\", void 0);\n__decorate([\n Autowired('popupService')\n], StandardMenuFactory.prototype, \"popupService\", void 0);\n__decorate([\n Autowired('focusService')\n], StandardMenuFactory.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], StandardMenuFactory.prototype, \"ctrlsService\", void 0);\nStandardMenuFactory = __decorate([\n Bean('menuFactory')\n], StandardMenuFactory);\nexport { StandardMenuFactory };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { RefSelector } from '../widgets/componentAnnotations.mjs';\nimport { ManagedFocusFeature } from '../widgets/managedFocusFeature.mjs';\nimport { clearElement } from '../utils/dom.mjs';\nimport { setAriaLabel, setAriaRole } from '../utils/aria.mjs';\nimport { callIfPresent } from '../utils/function.mjs';\nimport { KeyCode } from '../constants/keyCode.mjs';\nimport { Component } from '../widgets/component.mjs';\nimport { PostConstruct, Autowired } from '../context/context.mjs';\nexport class TabbedLayout extends Component {\n constructor(params) {\n super(TabbedLayout.getTemplate(params.cssClass));\n this.items = [];\n this.tabbedItemScrollMap = new Map();\n this.params = params;\n if (params.items) {\n params.items.forEach(item => this.addItem(item));\n }\n }\n postConstruct() {\n this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), {\n onTabKeyDown: this.onTabKeyDown.bind(this),\n handleKeyDown: this.handleKeyDown.bind(this)\n }));\n this.addDestroyFunc(() => { var _a, _b, _c; return (_c = (_b = (_a = this.activeItem) === null || _a === void 0 ? void 0 : _a.tabbedItem) === null || _b === void 0 ? void 0 : _b.afterDetachedCallback) === null || _c === void 0 ? void 0 : _c.call(_b); });\n }\n static getTemplate(cssClass) {\n return /* html */ `
\n
\n
\n
`;\n }\n handleKeyDown(e) {\n const eDocument = this.gridOptionsService.getDocument();\n switch (e.key) {\n case KeyCode.RIGHT:\n case KeyCode.LEFT:\n if (!this.eHeader.contains(eDocument.activeElement)) {\n return;\n }\n const isRightKey = e.key === KeyCode.RIGHT;\n const isRtl = this.gridOptionsService.is('enableRtl');\n const currentPosition = this.items.indexOf(this.activeItem);\n const nextPosition = isRightKey !== isRtl ? Math.min(currentPosition + 1, this.items.length - 1) : Math.max(currentPosition - 1, 0);\n if (currentPosition === nextPosition) {\n return;\n }\n e.preventDefault();\n const nextItem = this.items[nextPosition];\n this.showItemWrapper(nextItem);\n nextItem.eHeaderButton.focus();\n break;\n case KeyCode.UP:\n case KeyCode.DOWN:\n e.stopPropagation();\n break;\n }\n }\n onTabKeyDown(e) {\n if (e.defaultPrevented) {\n return;\n }\n const { focusService, eHeader, eBody, activeItem } = this;\n const eDocument = this.gridOptionsService.getDocument();\n const activeElement = eDocument.activeElement;\n const target = e.target;\n e.preventDefault();\n if (eHeader.contains(activeElement)) {\n // focus is in header, move into body of popup\n focusService.focusInto(eBody, e.shiftKey);\n return;\n }\n let nextEl = null;\n if (focusService.isTargetUnderManagedComponent(eBody, target)) {\n if (e.shiftKey) {\n nextEl = this.focusService.findFocusableElementBeforeTabGuard(eBody, target);\n }\n if (!nextEl) {\n nextEl = activeItem.eHeaderButton;\n }\n }\n if (!nextEl && eBody.contains(activeElement)) {\n nextEl = focusService.findNextFocusableElement(eBody, false, e.shiftKey);\n if (!nextEl) {\n nextEl = activeItem.eHeaderButton;\n }\n }\n if (nextEl) {\n nextEl.focus();\n }\n }\n setAfterAttachedParams(params) {\n this.afterAttachedParams = params;\n }\n showFirstItem() {\n if (this.items.length > 0) {\n this.showItemWrapper(this.items[0]);\n }\n }\n addItem(item) {\n const eHeaderButton = document.createElement('span');\n setAriaRole(eHeaderButton, 'tab');\n eHeaderButton.setAttribute('tabindex', '-1');\n eHeaderButton.appendChild(item.title);\n eHeaderButton.classList.add('ag-tab');\n this.eHeader.appendChild(eHeaderButton);\n setAriaLabel(eHeaderButton, item.titleLabel);\n const wrapper = {\n tabbedItem: item,\n eHeaderButton: eHeaderButton\n };\n this.items.push(wrapper);\n eHeaderButton.addEventListener('click', this.showItemWrapper.bind(this, wrapper));\n }\n showItem(tabbedItem) {\n const itemWrapper = this.items.find(wrapper => wrapper.tabbedItem === tabbedItem);\n if (itemWrapper) {\n this.showItemWrapper(itemWrapper);\n }\n }\n showItemWrapper(wrapper) {\n var _a, _b;\n const { tabbedItem, eHeaderButton } = wrapper;\n if (this.params.onItemClicked) {\n this.params.onItemClicked({ item: tabbedItem });\n }\n if (this.activeItem === wrapper) {\n callIfPresent(this.params.onActiveItemClicked);\n return;\n }\n if (this.lastScrollListener) {\n this.lastScrollListener = this.lastScrollListener();\n }\n clearElement(this.eBody);\n tabbedItem.bodyPromise.then((body) => {\n this.eBody.appendChild(body);\n const onlyUnmanaged = !this.focusService.isKeyboardMode();\n this.focusService.focusInto(this.eBody, false, onlyUnmanaged);\n if (tabbedItem.afterAttachedCallback) {\n tabbedItem.afterAttachedCallback(this.afterAttachedParams);\n }\n if (this.params.keepScrollPosition) {\n const scrollableContainer = (tabbedItem.getScrollableContainer && tabbedItem.getScrollableContainer()) || body;\n this.lastScrollListener = this.addManagedListener(scrollableContainer, 'scroll', () => {\n this.tabbedItemScrollMap.set(tabbedItem.name, scrollableContainer.scrollTop);\n });\n const scrollPosition = this.tabbedItemScrollMap.get(tabbedItem.name);\n if (scrollPosition !== undefined) {\n // Safari needs a small timeout or it will fire a scroll event to position 0\n setTimeout(() => {\n scrollableContainer.scrollTop = scrollPosition;\n }, 0);\n }\n }\n });\n if (this.activeItem) {\n this.activeItem.eHeaderButton.classList.remove('ag-tab-selected');\n (_b = (_a = this.activeItem.tabbedItem).afterDetachedCallback) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n eHeaderButton.classList.add('ag-tab-selected');\n this.activeItem = wrapper;\n }\n}\n__decorate([\n Autowired('focusService')\n], TabbedLayout.prototype, \"focusService\", void 0);\n__decorate([\n RefSelector('eHeader')\n], TabbedLayout.prototype, \"eHeader\", void 0);\n__decorate([\n RefSelector('eBody')\n], TabbedLayout.prototype, \"eBody\", void 0);\n__decorate([\n PostConstruct\n], TabbedLayout.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { offsetHeight, offsetWidth } from \"../utils/dom.mjs\";\nconst DEBOUNCE_DELAY = 50;\nlet ResizeObserverService = class ResizeObserverService extends BeanStub {\n constructor() {\n super(...arguments);\n this.polyfillFunctions = [];\n }\n observeResize(element, callback) {\n const win = this.gridOptionsService.getWindow();\n const useBrowserResizeObserver = () => {\n const resizeObserver = new win.ResizeObserver(callback);\n resizeObserver.observe(element);\n return () => resizeObserver.disconnect();\n };\n const usePolyfill = () => {\n // initialise to the current width and height, so first call will have no changes\n let widthLastTime = offsetWidth(element);\n let heightLastTime = offsetHeight(element);\n // when finished, this gets turned to false.\n let running = true;\n const periodicallyCheckWidthAndHeight = () => {\n if (running) {\n const newWidth = offsetWidth(element);\n const newHeight = offsetHeight(element);\n const changed = newWidth !== widthLastTime || newHeight !== heightLastTime;\n if (changed) {\n widthLastTime = newWidth;\n heightLastTime = newHeight;\n callback();\n }\n this.doNextPolyfillTurn(periodicallyCheckWidthAndHeight);\n }\n };\n periodicallyCheckWidthAndHeight();\n // the callback function we return sets running to false\n return () => running = false;\n };\n const suppressResize = this.gridOptionsService.is('suppressBrowserResizeObserver');\n const resizeObserverExists = !!win.ResizeObserver;\n if (resizeObserverExists && !suppressResize) {\n return useBrowserResizeObserver();\n }\n return usePolyfill();\n }\n doNextPolyfillTurn(func) {\n this.polyfillFunctions.push(func);\n this.schedulePolyfill();\n }\n schedulePolyfill() {\n if (this.polyfillScheduled) {\n return;\n }\n const executeAllFuncs = () => {\n const funcs = this.polyfillFunctions;\n // make sure set scheduled to false and clear clear array\n // before executing the funcs, as the funcs could add more funcs\n this.polyfillScheduled = false;\n this.polyfillFunctions = [];\n funcs.forEach(f => f());\n };\n this.polyfillScheduled = true;\n this.getFrameworkOverrides().setTimeout(executeAllFuncs, DEBOUNCE_DELAY);\n }\n};\nResizeObserverService = __decorate([\n Bean('resizeObserverService')\n], ResizeObserverService);\nexport { ResizeObserverService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nlet AnimationFrameService = class AnimationFrameService extends BeanStub {\n constructor() {\n super(...arguments);\n // p1 and p2 are create tasks are to do with row and cell creation.\n // for them we want to execute according to row order, so we use\n // TaskItem so we know what index the item is for.\n this.createTasksP1 = { list: [], sorted: false }; // eg drawing back-ground of rows\n this.createTasksP2 = { list: [], sorted: false }; // eg cell renderers, adding hover functionality\n // destroy tasks are to do with row removal. they are done after row creation as the user will need to see new\n // rows first (as blank is scrolled into view), when we remove the old rows (no longer in view) is not as\n // important.\n this.destroyTasks = [];\n this.ticking = false;\n // we need to know direction of scroll, to build up rows in the direction of\n // the scroll. eg if user scrolls down, we extend the rows by building down.\n this.scrollGoingDown = true;\n this.lastPage = 0;\n this.lastScrollTop = 0;\n this.taskCount = 0;\n this.cancelledTasks = new Set();\n }\n setScrollTop(scrollTop) {\n const isPaginationActive = this.gridOptionsService.is('pagination');\n this.scrollGoingDown = scrollTop >= this.lastScrollTop;\n if (isPaginationActive && scrollTop === 0) {\n const currentPage = this.paginationProxy.getCurrentPage();\n if (currentPage !== this.lastPage) {\n this.lastPage = currentPage;\n this.scrollGoingDown = true;\n }\n }\n this.lastScrollTop = scrollTop;\n }\n init() {\n this.useAnimationFrame = !this.gridOptionsService.is('suppressAnimationFrame');\n }\n isOn() {\n return this.useAnimationFrame;\n }\n // this method is for our AG Grid sanity only - if animation frames are turned off,\n // then no place in the code should be looking to add any work to be done in animation\n // frames. this stops bugs - where some code is asking for a frame to be executed\n // when it should not.\n verifyAnimationFrameOn(methodName) {\n if (this.useAnimationFrame === false) {\n console.warn(`AG Grid: AnimationFrameService.${methodName} called but animation frames are off`);\n }\n }\n createTask(task, index, list) {\n this.verifyAnimationFrameOn(list);\n const taskItem = { task, index, createOrder: ++this.taskCount };\n this.addTaskToList(this[list], taskItem);\n this.schedule();\n }\n cancelTask(task) {\n this.cancelledTasks.add(task);\n }\n addTaskToList(taskList, task) {\n taskList.list.push(task);\n taskList.sorted = false;\n }\n sortTaskList(taskList) {\n if (taskList.sorted) {\n return;\n }\n const sortDirection = this.scrollGoingDown ? 1 : -1;\n // sort first by row index (taking into account scroll direction), then by\n // order of task creation (always ascending, so cells will render left-to-right)\n taskList.list.sort((a, b) => a.index !== b.index ? sortDirection * (b.index - a.index) : b.createOrder - a.createOrder);\n taskList.sorted = true;\n }\n addDestroyTask(task) {\n this.verifyAnimationFrameOn('createTasksP3');\n this.destroyTasks.push(task);\n this.schedule();\n }\n executeFrame(millis) {\n this.verifyAnimationFrameOn('executeFrame');\n const p1TaskList = this.createTasksP1;\n const p1Tasks = p1TaskList.list;\n const p2TaskList = this.createTasksP2;\n const p2Tasks = p2TaskList.list;\n const destroyTasks = this.destroyTasks;\n const frameStart = new Date().getTime();\n let duration = (new Date().getTime()) - frameStart;\n // 16ms is 60 fps\n const noMaxMillis = millis <= 0;\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n while (noMaxMillis || duration < millis) {\n const gridBodyDidSomething = gridBodyCon.getScrollFeature().scrollGridIfNeeded();\n if (!gridBodyDidSomething) {\n let task;\n if (p1Tasks.length) {\n this.sortTaskList(p1TaskList);\n task = p1Tasks.pop().task;\n }\n else if (p2Tasks.length) {\n this.sortTaskList(p2TaskList);\n task = p2Tasks.pop().task;\n }\n else if (destroyTasks.length) {\n task = destroyTasks.pop();\n }\n else {\n this.cancelledTasks.clear();\n break;\n }\n if (!this.cancelledTasks.has(task)) {\n task();\n }\n }\n duration = (new Date().getTime()) - frameStart;\n }\n if (p1Tasks.length || p2Tasks.length || destroyTasks.length) {\n this.requestFrame();\n }\n else {\n this.stopTicking();\n }\n }\n stopTicking() {\n this.ticking = false;\n }\n flushAllFrames() {\n if (!this.useAnimationFrame) {\n return;\n }\n this.executeFrame(-1);\n }\n schedule() {\n if (!this.useAnimationFrame) {\n return;\n }\n if (!this.ticking) {\n this.ticking = true;\n this.requestFrame();\n }\n }\n requestFrame() {\n // check for the existence of requestAnimationFrame, and if\n // it's missing, then we polyfill it with setTimeout()\n const callback = this.executeFrame.bind(this, 60);\n this.requestAnimationFrame(callback);\n }\n requestAnimationFrame(callback) {\n const win = this.gridOptionsService.getWindow();\n if (win.requestAnimationFrame) {\n win.requestAnimationFrame(callback);\n }\n else if (win.webkitRequestAnimationFrame) {\n win.webkitRequestAnimationFrame(callback);\n }\n else {\n win.setTimeout(callback, 0);\n }\n }\n isQueueEmpty() {\n return !this.ticking;\n }\n // a debounce utility used for parts of the app involved with rendering.\n // the advantage over normal debounce is the client can call flushAllFrames()\n // to make sure all rendering is complete. we don't wait any milliseconds,\n // as this is intended to batch calls in one VM turn.\n debounce(func) {\n let pending = false;\n return () => {\n if (!this.isOn()) {\n this.getFrameworkOverrides().setTimeout(func, 0);\n return;\n }\n if (pending) {\n return;\n }\n pending = true;\n this.addDestroyTask(() => {\n pending = false;\n func();\n });\n };\n }\n};\n__decorate([\n Autowired('ctrlsService')\n], AnimationFrameService.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('paginationProxy')\n], AnimationFrameService.prototype, \"paginationProxy\", void 0);\n__decorate([\n PostConstruct\n], AnimationFrameService.prototype, \"init\", null);\nAnimationFrameService = __decorate([\n Bean('animationFrameService')\n], AnimationFrameService);\nexport { AnimationFrameService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nlet AutoWidthCalculator = class AutoWidthCalculator extends BeanStub {\n postConstruct() {\n this.ctrlsService.whenReady(p => {\n this.centerRowContainerCtrl = p.centerRowContainerCtrl;\n });\n }\n // this is the trick: we create a dummy container and clone all the cells\n // into the dummy, then check the dummy's width. then destroy the dummy\n // as we don't need it any more.\n // drawback: only the cells visible on the screen are considered\n getPreferredWidthForColumn(column, skipHeader) {\n const eHeaderCell = this.getHeaderCellForColumn(column);\n // cell isn't visible\n if (!eHeaderCell) {\n return -1;\n }\n const elements = this.rowRenderer.getAllCellsForColumn(column);\n if (!skipHeader) {\n // we only consider the lowest level cell, not the group cell. in 99% of the time, this\n // will be enough. if we consider groups, then it gets too complicated for what it's worth,\n // as the groups can span columns and this class only considers one column at a time.\n elements.push(eHeaderCell);\n }\n return this.addElementsToContainerAndGetWidth(elements);\n }\n getPreferredWidthForColumnGroup(columnGroup) {\n const eHeaderCell = this.getHeaderCellForColumn(columnGroup);\n if (!eHeaderCell) {\n return -1;\n }\n return this.addElementsToContainerAndGetWidth([eHeaderCell]);\n }\n addElementsToContainerAndGetWidth(elements) {\n // this element has to be a form, otherwise form elements within a cell\n // will be validated while being cloned. This can cause issues such as \n // radio buttons being reset and losing their values.\n const eDummyContainer = document.createElement('form');\n // position fixed, so it isn't restricted to the boundaries of the parent\n eDummyContainer.style.position = 'fixed';\n // we put the dummy into the body container, so it will inherit all the\n // css styles that the real cells are inheriting\n const eBodyContainer = this.centerRowContainerCtrl.getContainerElement();\n elements.forEach(el => this.cloneItemIntoDummy(el, eDummyContainer));\n // only append the dummyContainer to the DOM after it contains all the necessary items\n eBodyContainer.appendChild(eDummyContainer);\n // at this point, all the clones are lined up vertically with natural widths. the dummy\n // container will have a width wide enough just to fit the largest.\n const dummyContainerWidth = eDummyContainer.offsetWidth;\n // we are finished with the dummy container, so get rid of it\n eBodyContainer.removeChild(eDummyContainer);\n // we add padding as I found sometimes the gui still put '...' after some of the texts. so the\n // user can configure the grid to add a few more pixels after the calculated width\n const autoSizePadding = this.getAutoSizePadding();\n return dummyContainerWidth + autoSizePadding;\n }\n getAutoSizePadding() {\n const value = this.gridOptionsService.getNum('autoSizePadding');\n return value != null && value >= 0 ? value : 20;\n }\n getHeaderCellForColumn(column) {\n /* tslint:enable */\n let element = null;\n this.ctrlsService.getHeaderRowContainerCtrls().forEach(container => {\n const res = container.getHtmlElementForColumnHeader(column);\n if (res != null) {\n element = res;\n }\n });\n return element;\n }\n cloneItemIntoDummy(eCell, eDummyContainer) {\n // make a deep clone of the cell\n const eCellClone = eCell.cloneNode(true);\n // the original has a fixed width, we remove this to allow the natural width based on content\n eCellClone.style.width = '';\n // the original has position = absolute, we need to remove this so it's positioned normally\n eCellClone.style.position = 'static';\n eCellClone.style.left = '';\n // we put the cell into a containing div, as otherwise the cells would just line up\n // on the same line, standard flow layout, by putting them into divs, they are laid\n // out one per line\n const eCloneParent = document.createElement('div');\n const eCloneParentClassList = eCloneParent.classList;\n const isHeader = ['ag-header-cell', 'ag-header-group-cell'].some(cls => eCellClone.classList.contains(cls));\n if (isHeader) {\n eCloneParentClassList.add('ag-header', 'ag-header-row');\n eCloneParent.style.position = 'static';\n }\n else {\n eCloneParentClassList.add('ag-row');\n }\n // find parent using classes (headers have ag-header-cell, rows have ag-row), and copy classes from it.\n // if we didn't do this, things like ag-row-level-2 would be missing if present, which sets indents\n // onto group items.\n let pointer = eCell.parentElement;\n while (pointer) {\n const isRow = ['ag-header-row', 'ag-row'].some(cls => pointer.classList.contains(cls));\n if (isRow) {\n for (let i = 0; i < pointer.classList.length; i++) {\n const item = pointer.classList[i];\n // we skip ag-row-position-absolute, as this has structural CSS applied that stops the\n // element from fitting into it's parent, and we need the element to stretch the parent\n // as we are measuring the parents width\n if (item != 'ag-row-position-absolute') {\n eCloneParentClassList.add(item);\n }\n }\n break;\n }\n pointer = pointer.parentElement;\n }\n // the twig on the branch, the branch on the tree, the tree in the hole,\n // the hole in the bog, the bog in the clone, the clone in the parent,\n // the parent in the dummy, and the dummy down in the vall-e-ooo, OOOOOOOOO! Oh row the rattling bog....\n eCloneParent.appendChild(eCellClone);\n eDummyContainer.appendChild(eCloneParent);\n }\n};\n__decorate([\n Autowired('rowRenderer')\n], AutoWidthCalculator.prototype, \"rowRenderer\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], AutoWidthCalculator.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('rowCssClassCalculator')\n], AutoWidthCalculator.prototype, \"rowCssClassCalculator\", void 0);\n__decorate([\n PostConstruct\n], AutoWidthCalculator.prototype, \"postConstruct\", null);\nAutoWidthCalculator = __decorate([\n Bean('autoWidthCalculator')\n], AutoWidthCalculator);\nexport { AutoWidthCalculator };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { Autowired, PostConstruct } from \"../../context/context.mjs\";\nimport { last } from \"../../utils/array.mjs\";\nexport class StickyRowFeature extends BeanStub {\n constructor(createRowCon, destroyRowCtrls) {\n super();\n this.createRowCon = createRowCon;\n this.destroyRowCtrls = destroyRowCtrls;\n this.stickyRowCtrls = [];\n this.containerHeight = 0;\n }\n postConstruct() {\n this.isClientSide = this.rowModel.getType() === 'clientSide';\n this.ctrlsService.whenReady(params => {\n this.gridBodyCtrl = params.gridBodyCtrl;\n });\n }\n getStickyRowCtrls() {\n return this.stickyRowCtrls;\n }\n checkStickyRows() {\n let height = 0;\n if (!this.gridOptionsService.isGroupRowsSticky()) {\n return this.refreshNodesAndContainerHeight([], height);\n }\n const stickyRows = [];\n const firstPixel = this.rowRenderer.getFirstVisibleVerticalPixel();\n const addStickyRow = (stickyRow) => {\n var _a, _b, _c;\n stickyRows.push(stickyRow);\n let lastChildBottom;\n if (this.isClientSide) {\n let lastAncestor = stickyRow;\n while (lastAncestor.expanded) {\n if (lastAncestor.master) {\n lastAncestor = lastAncestor.detailNode;\n }\n else if (lastAncestor.childrenAfterSort) {\n // Tree Data will have `childrenAfterSort` without any nodes, but\n // the current node will still be marked as expansible.\n if (lastAncestor.childrenAfterSort.length === 0) {\n break;\n }\n lastAncestor = last(lastAncestor.childrenAfterSort);\n }\n }\n lastChildBottom = lastAncestor.rowTop + lastAncestor.rowHeight;\n }\n // if the rowModel is `serverSide` as only `clientSide` and `serverSide` create this feature.\n else {\n if (stickyRow.master) {\n lastChildBottom = stickyRow.detailNode.rowTop + stickyRow.detailNode.rowHeight;\n }\n else {\n const storeBounds = (_a = stickyRow.childStore) === null || _a === void 0 ? void 0 : _a.getStoreBounds();\n lastChildBottom = ((_b = storeBounds === null || storeBounds === void 0 ? void 0 : storeBounds.heightPx) !== null && _b !== void 0 ? _b : 0) + ((_c = storeBounds === null || storeBounds === void 0 ? void 0 : storeBounds.topPx) !== null && _c !== void 0 ? _c : 0);\n }\n }\n const stickRowBottom = firstPixel + height + stickyRow.rowHeight;\n if (lastChildBottom < stickRowBottom) {\n stickyRow.stickyRowTop = height + (lastChildBottom - stickRowBottom);\n }\n else {\n stickyRow.stickyRowTop = height;\n }\n height = 0;\n stickyRows.forEach(rowNode => {\n const thisRowLastPx = rowNode.stickyRowTop + rowNode.rowHeight;\n if (height < thisRowLastPx) {\n height = thisRowLastPx;\n }\n });\n };\n while (true) {\n const firstPixelAfterStickyRows = firstPixel + height;\n const firstIndex = this.rowModel.getRowIndexAtPixel(firstPixelAfterStickyRows);\n const firstRow = this.rowModel.getRow(firstIndex);\n if (firstRow == null) {\n break;\n }\n // only happens when pivoting, and we are showing root node\n if (firstRow.level < 0) {\n break;\n }\n const parents = [];\n let p = firstRow.parent;\n while (p.level >= 0) {\n parents.push(p);\n p = p.parent;\n }\n const firstMissingParent = parents.reverse().find(parent => stickyRows.indexOf(parent) < 0 && parent.displayed);\n if (firstMissingParent) {\n addStickyRow(firstMissingParent);\n continue;\n }\n // if first row is an open group, and practically shown, it needs\n // to be stuck\n if (firstRow.isExpandable() && firstRow.expanded && firstRow.rowTop < firstPixelAfterStickyRows) {\n addStickyRow(firstRow);\n continue;\n }\n break;\n }\n return this.refreshNodesAndContainerHeight(stickyRows, height);\n }\n refreshStickyNode(stickRowNode) {\n const allStickyNodes = [];\n for (let i = 0; i < this.stickyRowCtrls.length; i++) {\n const currentNode = this.stickyRowCtrls[i].getRowNode();\n if (currentNode !== stickRowNode) {\n allStickyNodes.push(currentNode);\n }\n }\n if (this.refreshNodesAndContainerHeight(allStickyNodes, this.containerHeight)) {\n this.checkStickyRows();\n }\n }\n refreshNodesAndContainerHeight(allStickyNodes, height) {\n let stickyRowsChanged = false;\n const removedCtrls = this.stickyRowCtrls.filter(ctrl => allStickyNodes.indexOf(ctrl.getRowNode()) === -1);\n const addedNodes = allStickyNodes.filter(rowNode => this.stickyRowCtrls.findIndex(ctrl => ctrl.getRowNode() === rowNode) === -1);\n if (removedCtrls.length || addedNodes.length) {\n stickyRowsChanged = true;\n }\n const ctrlsToDestroy = {};\n removedCtrls.forEach(removedCtrl => {\n ctrlsToDestroy[removedCtrl.getRowNode().id] = removedCtrl;\n this.stickyRowCtrls = this.stickyRowCtrls.filter(ctrl => ctrl !== removedCtrl);\n });\n for (const ctrl of Object.values(ctrlsToDestroy)) {\n ctrl.getRowNode().sticky = false;\n }\n this.destroyRowCtrls(ctrlsToDestroy, false);\n const newCtrls = addedNodes.map(rowNode => {\n rowNode.sticky = true;\n return this.createRowCon(rowNode, false, false);\n });\n this.stickyRowCtrls.push(...newCtrls);\n this.stickyRowCtrls.forEach(ctrl => ctrl.setRowTop(ctrl.getRowNode().stickyRowTop));\n this.stickyRowCtrls.sort((a, b) => b.getRowNode().rowIndex - a.getRowNode().rowIndex);\n if (this.containerHeight !== height) {\n this.containerHeight = height;\n this.gridBodyCtrl.setStickyTopHeight(height);\n stickyRowsChanged = true;\n }\n return stickyRowsChanged;\n }\n}\n__decorate([\n Autowired(\"rowModel\")\n], StickyRowFeature.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired(\"rowRenderer\")\n], StickyRowFeature.prototype, \"rowRenderer\", void 0);\n__decorate([\n Autowired(\"ctrlsService\")\n], StickyRowFeature.prototype, \"ctrlsService\", void 0);\n__decorate([\n PostConstruct\n], StickyRowFeature.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { RowCtrl } from \"./row/rowCtrl.mjs\";\nimport { Events } from \"../events.mjs\";\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nimport { getAllValuesInObject, iterateObject } from \"../utils/object.mjs\";\nimport { createArrayOfNumbers } from \"../utils/number.mjs\";\nimport { doOnce, executeInAWhile } from \"../utils/function.mjs\";\nimport { CellCtrl } from \"./cell/cellCtrl.mjs\";\nimport { removeFromArray } from \"../utils/array.mjs\";\nimport { StickyRowFeature } from \"./features/stickyRowFeature.mjs\";\nimport { browserSupportsPreventScroll } from \"../utils/browser.mjs\";\nconst DEFAULT_KEEP_DETAIL_ROW_COUNT = 10;\nlet RowRenderer = class RowRenderer extends BeanStub {\n constructor() {\n super(...arguments);\n this.destroyFuncsForColumnListeners = [];\n // map of row ids to row objects. keeps track of which elements\n // are rendered for which rows in the dom.\n this.rowCtrlsByRowIndex = {};\n this.zombieRowCtrls = {};\n this.allRowCtrls = [];\n this.topRowCtrls = [];\n this.bottomRowCtrls = [];\n // we only allow one refresh at a time, otherwise the internal memory structure here\n // will get messed up. this can happen if the user has a cellRenderer, and inside the\n // renderer they call an API method that results in another pass of the refresh,\n // then it will be trying to draw rows in the middle of a refresh.\n this.refreshInProgress = false;\n this.dataFirstRenderedFired = false;\n }\n postConstruct() {\n this.ctrlsService.whenReady(() => {\n this.gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();\n this.initialise();\n });\n }\n initialise() {\n this.addManagedListener(this.eventService, Events.EVENT_PAGINATION_CHANGED, this.onPageLoaded.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_PINNED_ROW_DATA_CHANGED, this.onPinnedRowDataChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, this.onBodyScroll.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, this.redraw.bind(this));\n this.addManagedPropertyListener('domLayout', this.onDomLayoutChanged.bind(this));\n this.addManagedPropertyListener('rowClass', this.redrawRows.bind(this));\n if (this.gridOptionsService.isGroupRowsSticky()) {\n const rowModelType = this.rowModel.getType();\n if (rowModelType === 'clientSide' || rowModelType === 'serverSide') {\n this.stickyRowFeature = this.createManagedBean(new StickyRowFeature(this.createRowCon.bind(this), this.destroyRowCtrls.bind(this)));\n }\n }\n this.registerCellEventListeners();\n this.initialiseCache();\n this.printLayout = this.gridOptionsService.isDomLayout('print');\n this.embedFullWidthRows = this.printLayout || this.gridOptionsService.is('embedFullWidthRows');\n this.redrawAfterModelUpdate();\n }\n initialiseCache() {\n if (this.gridOptionsService.is('keepDetailRows')) {\n const countProp = this.getKeepDetailRowsCount();\n const count = countProp != null ? countProp : 3;\n this.cachedRowCtrls = new RowCtrlCache(count);\n }\n }\n getKeepDetailRowsCount() {\n const keepDetailRowsCount = this.gridOptionsService.getNum('keepDetailRowsCount');\n if (exists(keepDetailRowsCount) && keepDetailRowsCount > 0) {\n return keepDetailRowsCount;\n }\n return DEFAULT_KEEP_DETAIL_ROW_COUNT;\n }\n getStickyTopRowCtrls() {\n if (!this.stickyRowFeature) {\n return [];\n }\n return this.stickyRowFeature.getStickyRowCtrls();\n }\n updateAllRowCtrls() {\n const liveList = getAllValuesInObject(this.rowCtrlsByRowIndex);\n const isEnsureDomOrder = this.gridOptionsService.is('ensureDomOrder');\n const isPrintLayout = this.gridOptionsService.isDomLayout('print');\n if (isEnsureDomOrder || isPrintLayout) {\n liveList.sort((a, b) => a.getRowNode().rowIndex - b.getRowNode.rowIndex);\n }\n const zombieList = getAllValuesInObject(this.zombieRowCtrls);\n const cachedList = this.cachedRowCtrls ? this.cachedRowCtrls.getEntries() : [];\n if (zombieList.length > 0 || cachedList.length > 0) {\n // Only spread if we need to.\n this.allRowCtrls = [...liveList, ...zombieList, ...cachedList];\n }\n else {\n this.allRowCtrls = liveList;\n }\n }\n onCellFocusChanged(event) {\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.onCellFocused(event));\n this.getFullWidthRowCtrls().forEach(rowCtrl => rowCtrl.onFullWidthRowFocused(event));\n }\n // in a clean design, each cell would register for each of these events. however when scrolling, all the cells\n // registering and de-registering for events is a performance bottleneck. so we register here once and inform\n // all active cells.\n registerCellEventListeners() {\n this.addManagedListener(this.eventService, Events.EVENT_CELL_FOCUSED, (event) => {\n this.onCellFocusChanged(event);\n });\n this.addManagedListener(this.eventService, Events.EVENT_CELL_FOCUS_CLEARED, () => {\n this.onCellFocusChanged();\n });\n this.addManagedListener(this.eventService, Events.EVENT_FLASH_CELLS, event => {\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.onFlashCells(event));\n });\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, () => {\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.onColumnHover());\n });\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, () => {\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.onDisplayedColumnsChanged());\n });\n // only for printLayout - because we are rendering all the cells in the same row, regardless of pinned state,\n // then changing the width of the containers will impact left position. eg the center cols all have their\n // left position adjusted by the width of the left pinned column, so if the pinned left column width changes,\n // all the center cols need to be shifted to accommodate this. when in normal layout, the pinned cols are\n // in different containers so doesn't impact.\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, () => {\n if (this.printLayout) {\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.onLeftChanged());\n }\n });\n const rangeSelectionEnabled = this.gridOptionsService.isEnableRangeSelection();\n if (rangeSelectionEnabled) {\n this.addManagedListener(this.eventService, Events.EVENT_RANGE_SELECTION_CHANGED, () => {\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.onRangeSelectionChanged());\n });\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, () => {\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.updateRangeBordersIfRangeCount());\n });\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, () => {\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.updateRangeBordersIfRangeCount());\n });\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, () => {\n this.getAllCellCtrls().forEach(cellCtrl => cellCtrl.updateRangeBordersIfRangeCount());\n });\n }\n // add listeners to the grid columns\n this.refreshListenersToColumnsForCellComps();\n // if the grid columns change, then refresh the listeners again\n this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.refreshListenersToColumnsForCellComps.bind(this));\n this.addDestroyFunc(this.removeGridColumnListeners.bind(this));\n }\n // executes all functions in destroyFuncsForColumnListeners and then clears the list\n removeGridColumnListeners() {\n this.destroyFuncsForColumnListeners.forEach(func => func());\n this.destroyFuncsForColumnListeners.length = 0;\n }\n // this function adds listeners onto all the grid columns, which are the column that we could have cellComps for.\n // when the grid columns change, we add listeners again. in an ideal design, each CellComp would just register to\n // the column it belongs to on creation, however this was a bottleneck with the number of cells, so do it here\n // once instead.\n refreshListenersToColumnsForCellComps() {\n this.removeGridColumnListeners();\n const cols = this.columnModel.getAllGridColumns();\n if (!cols) {\n return;\n }\n cols.forEach(col => {\n const forEachCellWithThisCol = (callback) => {\n this.getAllCellCtrls().forEach(cellCtrl => {\n if (cellCtrl.getColumn() === col) {\n callback(cellCtrl);\n }\n });\n };\n const leftChangedListener = () => {\n forEachCellWithThisCol(cellCtrl => cellCtrl.onLeftChanged());\n };\n const widthChangedListener = () => {\n forEachCellWithThisCol(cellCtrl => cellCtrl.onWidthChanged());\n };\n const firstRightPinnedChangedListener = () => {\n forEachCellWithThisCol(cellCtrl => cellCtrl.onFirstRightPinnedChanged());\n };\n const lastLeftPinnedChangedListener = () => {\n forEachCellWithThisCol(cellCtrl => cellCtrl.onLastLeftPinnedChanged());\n };\n const colDefChangedListener = () => {\n forEachCellWithThisCol(cellCtrl => cellCtrl.onColDefChanged());\n };\n col.addEventListener('leftChanged', leftChangedListener);\n col.addEventListener('widthChanged', widthChangedListener);\n col.addEventListener('firstRightPinnedChanged', firstRightPinnedChangedListener);\n col.addEventListener('lastLeftPinnedChanged', lastLeftPinnedChangedListener);\n col.addEventListener('colDefChanged', colDefChangedListener);\n this.destroyFuncsForColumnListeners.push(() => {\n col.removeEventListener('leftChanged', leftChangedListener);\n col.removeEventListener('widthChanged', widthChangedListener);\n col.removeEventListener('firstRightPinnedChanged', firstRightPinnedChangedListener);\n col.removeEventListener('lastLeftPinnedChanged', lastLeftPinnedChangedListener);\n col.removeEventListener('colDefChanged', colDefChangedListener);\n });\n });\n }\n onDomLayoutChanged() {\n const printLayout = this.gridOptionsService.isDomLayout('print');\n const embedFullWidthRows = printLayout || this.gridOptionsService.is('embedFullWidthRows');\n // if moving towards or away from print layout, means we need to destroy all rows, as rows are not laid\n // out using absolute positioning when doing print layout\n const destroyRows = embedFullWidthRows !== this.embedFullWidthRows || this.printLayout !== printLayout;\n this.printLayout = printLayout;\n this.embedFullWidthRows = embedFullWidthRows;\n if (destroyRows) {\n this.redrawAfterModelUpdate({ domLayoutChanged: true });\n }\n }\n // for row models that have datasources, when we update the datasource, we need to force the rowRenderer\n // to redraw all rows. otherwise the old rows from the old datasource will stay displayed.\n datasourceChanged() {\n this.firstRenderedRow = 0;\n this.lastRenderedRow = -1;\n const rowIndexesToRemove = Object.keys(this.rowCtrlsByRowIndex);\n this.removeRowCtrls(rowIndexesToRemove);\n }\n onPageLoaded(event) {\n const params = {\n recycleRows: event.keepRenderedRows,\n animate: event.animate,\n newData: event.newData,\n newPage: event.newPage,\n // because this is a model updated event (not pinned rows), we\n // can skip updating the pinned rows. this is needed so that if user\n // is doing transaction updates, the pinned rows are not getting constantly\n // trashed - or editing cells in pinned rows are not refreshed and put into read mode\n onlyBody: true\n };\n this.redrawAfterModelUpdate(params);\n }\n getAllCellsForColumn(column) {\n const res = [];\n this.getAllRowCtrls().forEach(rowCtrl => {\n const eCell = rowCtrl.getCellElement(column);\n if (eCell) {\n res.push(eCell);\n }\n });\n return res;\n }\n refreshFloatingRowComps() {\n this.refreshFloatingRows(this.topRowCtrls, this.pinnedRowModel.getPinnedTopRowData());\n this.refreshFloatingRows(this.bottomRowCtrls, this.pinnedRowModel.getPinnedBottomRowData());\n }\n getTopRowCtrls() {\n return this.topRowCtrls;\n }\n getCentreRowCtrls() {\n return this.allRowCtrls;\n }\n getBottomRowCtrls() {\n return this.bottomRowCtrls;\n }\n refreshFloatingRows(rowComps, rowNodes) {\n rowComps.forEach((row) => {\n row.destroyFirstPass();\n row.destroySecondPass();\n });\n rowComps.length = 0;\n if (!rowNodes) {\n return;\n }\n rowNodes.forEach(rowNode => {\n const rowCtrl = new RowCtrl(rowNode, this.beans, false, false, this.printLayout);\n rowComps.push(rowCtrl);\n });\n }\n onPinnedRowDataChanged() {\n // recycling rows in order to ensure cell editing is not cancelled\n const params = {\n recycleRows: true\n };\n this.redrawAfterModelUpdate(params);\n }\n redrawRow(rowNode, suppressEvent = false) {\n if (rowNode.sticky) {\n this.stickyRowFeature.refreshStickyNode(rowNode);\n }\n else {\n const destroyAndRecreateCtrl = (dataStruct) => {\n const ctrl = dataStruct[rowNode.rowIndex];\n if (!ctrl) {\n return;\n }\n if (ctrl.getRowNode() !== rowNode) {\n // if the node is in the wrong place, then the row model is responsible for triggering a full refresh.\n return;\n }\n ctrl.destroyFirstPass();\n ctrl.destroySecondPass();\n dataStruct[rowNode.rowIndex] = this.createRowCon(rowNode, false, false);\n };\n switch (rowNode.rowPinned) {\n case 'top':\n destroyAndRecreateCtrl(this.topRowCtrls);\n case 'bottom':\n destroyAndRecreateCtrl(this.bottomRowCtrls);\n default:\n destroyAndRecreateCtrl(this.rowCtrlsByRowIndex);\n this.updateAllRowCtrls();\n }\n }\n if (!suppressEvent) {\n this.dispatchDisplayedRowsChanged(false);\n }\n }\n redrawRows(rowNodes) {\n // if no row nodes provided, then refresh everything\n const partialRefresh = rowNodes != null;\n if (partialRefresh) {\n rowNodes === null || rowNodes === void 0 ? void 0 : rowNodes.forEach(node => this.redrawRow(node, true));\n this.dispatchDisplayedRowsChanged(false);\n return;\n }\n this.redrawAfterModelUpdate();\n }\n getCellToRestoreFocusToAfterRefresh(params) {\n const focusedCell = (params === null || params === void 0 ? void 0 : params.suppressKeepFocus) ? null : this.focusService.getFocusCellToUseAfterRefresh();\n if (focusedCell == null) {\n return null;\n }\n // if the dom is not actually focused on a cell, then we don't try to refocus. the problem this\n // solves is with editing - if the user is editing, eg focus is on a text field, and not on the\n // cell itself, then the cell can be registered as having focus, however it's the text field that\n // has the focus and not the cell div. therefore, when the refresh is finished, the grid will focus\n // the cell, and not the textfield. that means if the user is in a text field, and the grid refreshes,\n // the focus is lost from the text field. we do not want this.\n const eDocument = this.gridOptionsService.getDocument();\n const activeElement = eDocument.activeElement;\n const cellDomData = this.gridOptionsService.getDomData(activeElement, CellCtrl.DOM_DATA_KEY_CELL_CTRL);\n const rowDomData = this.gridOptionsService.getDomData(activeElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL);\n const gridElementFocused = cellDomData || rowDomData;\n return gridElementFocused ? focusedCell : null;\n }\n // gets called from:\n // +) initialisation (in registerGridComp) params = null\n // +) onDomLayoutChanged, params = null\n // +) onPageLoaded, recycleRows, animate, newData, newPage from event, onlyBody=true\n // +) onPinnedRowDataChanged, recycleRows = true\n // +) redrawRows (from Grid API), recycleRows = true/false\n redrawAfterModelUpdate(params = {}) {\n this.getLockOnRefresh();\n const focusedCell = this.getCellToRestoreFocusToAfterRefresh(params);\n this.updateContainerHeights();\n this.scrollToTopIfNewData(params);\n // never recycle rows on layout change as rows could change from normal DOM layout\n // back to the grid's row positioning.\n const recycleRows = !params.domLayoutChanged && !!params.recycleRows;\n const animate = params.animate && this.gridOptionsService.isAnimateRows();\n // after modelUpdate, row indexes can change, so we clear out the rowsByIndex map,\n // however we can reuse the rows, so we keep them but index by rowNode.id\n const rowsToRecycle = recycleRows ? this.getRowsToRecycle() : null;\n if (!recycleRows) {\n this.removeAllRowComps();\n }\n this.workOutFirstAndLastRowsToRender();\n if (this.stickyRowFeature) {\n this.stickyRowFeature.checkStickyRows();\n }\n this.recycleRows(rowsToRecycle, animate);\n this.gridBodyCtrl.updateRowCount();\n if (!params.onlyBody) {\n this.refreshFloatingRowComps();\n }\n this.dispatchDisplayedRowsChanged();\n // if a cell was focused before, ensure focus now.\n if (focusedCell != null) {\n this.restoreFocusedCell(focusedCell);\n }\n this.releaseLockOnRefresh();\n }\n scrollToTopIfNewData(params) {\n const scrollToTop = params.newData || params.newPage;\n const suppressScrollToTop = this.gridOptionsService.is('suppressScrollOnNewData');\n if (scrollToTop && !suppressScrollToTop) {\n this.gridBodyCtrl.getScrollFeature().scrollToTop();\n }\n }\n updateContainerHeights() {\n // when doing print layout, we don't explicitly set height on the containers\n if (this.printLayout) {\n this.rowContainerHeightService.setModelHeight(null);\n return;\n }\n let containerHeight = this.paginationProxy.getCurrentPageHeight();\n // we need at least 1 pixel for the horizontal scroll to work. so if there are now rows,\n // we still want the scroll to be present, otherwise there would be no way to scroll the header\n // which might be needed us user wants to access columns\n // on the RHS - and if that was where the filter was that cause no rows to be presented, there\n // is no way to remove the filter.\n if (containerHeight === 0) {\n containerHeight = 1;\n }\n this.rowContainerHeightService.setModelHeight(containerHeight);\n }\n getLockOnRefresh() {\n if (this.refreshInProgress) {\n throw new Error(\"AG Grid: cannot get grid to draw rows when it is in the middle of drawing rows. \" +\n \"Your code probably called a grid API method while the grid was in the render stage. To overcome \" +\n \"this, put the API call into a timeout, e.g. instead of api.redrawRows(), \" +\n \"call setTimeout(function() { api.redrawRows(); }, 0). To see what part of your code \" +\n \"that caused the refresh check this stacktrace.\");\n }\n this.refreshInProgress = true;\n }\n releaseLockOnRefresh() {\n this.refreshInProgress = false;\n }\n isRefreshInProgress() {\n return this.refreshInProgress;\n }\n // sets the focus to the provided cell, if the cell is provided. this way, the user can call refresh without\n // worry about the focus been lost. this is important when the user is using keyboard navigation to do edits\n // and the cellEditor is calling 'refresh' to get other cells to update (as other cells might depend on the\n // edited cell).\n restoreFocusedCell(cellPosition) {\n if (cellPosition) {\n // we don't wish to dispatch an event as the rowRenderer is not capable of changing the selected cell,\n // so we mock a change event for the full width rows and cells to ensure they update to the newly selected\n // state\n this.focusService.setRestoreFocusedCell(cellPosition);\n this.onCellFocusChanged({\n rowIndex: cellPosition.rowIndex,\n column: cellPosition.column,\n rowPinned: cellPosition.rowPinned,\n forceBrowserFocus: true,\n preventScrollOnBrowserFocus: true,\n api: this.beans.gridApi,\n columnApi: this.beans.columnApi,\n context: this.beans.gridOptionsService.context,\n type: 'mock',\n });\n }\n }\n stopEditing(cancel = false) {\n this.getAllRowCtrls().forEach(rowCtrl => {\n rowCtrl.stopEditing(cancel);\n });\n }\n getAllCellCtrls() {\n const res = [];\n const rowCtrls = this.getAllRowCtrls();\n const rowCtrlsLength = rowCtrls.length;\n for (let i = 0; i < rowCtrlsLength; i++) {\n const cellCtrls = rowCtrls[i].getAllCellCtrls();\n const cellCtrlsLength = cellCtrls.length;\n for (let j = 0; j < cellCtrlsLength; j++) {\n res.push(cellCtrls[j]);\n }\n }\n return res;\n }\n getAllRowCtrls() {\n const stickyRowCtrls = (this.stickyRowFeature && this.stickyRowFeature.getStickyRowCtrls()) || [];\n const res = [...this.topRowCtrls, ...this.bottomRowCtrls, ...stickyRowCtrls];\n for (const key of Object.keys(this.rowCtrlsByRowIndex)) {\n res.push(this.rowCtrlsByRowIndex[key]);\n }\n return res;\n }\n addRenderedRowListener(eventName, rowIndex, callback) {\n const rowComp = this.rowCtrlsByRowIndex[rowIndex];\n if (rowComp) {\n rowComp.addEventListener(eventName, callback);\n }\n }\n flashCells(params = {}) {\n const { flashDelay, fadeDelay } = params;\n this.getCellCtrls(params.rowNodes, params.columns)\n .forEach(cellCtrl => cellCtrl.flashCell({ flashDelay, fadeDelay }));\n }\n refreshCells(params = {}) {\n const refreshCellParams = {\n forceRefresh: params.force,\n newData: false,\n suppressFlash: params.suppressFlash\n };\n this.getCellCtrls(params.rowNodes, params.columns)\n .forEach(cellCtrl => {\n if (cellCtrl.refreshShouldDestroy()) {\n const rowCtrl = cellCtrl.getRowCtrl();\n if (rowCtrl) {\n rowCtrl.refreshCell(cellCtrl);\n }\n }\n else {\n cellCtrl.refreshCell(refreshCellParams);\n }\n });\n if (params.rowNodes) {\n // refresh the full width rows too\n this.getRowCtrls(params.rowNodes).forEach(rowCtrl => {\n if (!rowCtrl.isFullWidth()) {\n return;\n }\n const refreshed = rowCtrl.refreshFullWidth();\n if (!refreshed) {\n this.redrawRow(rowCtrl.getRowNode(), true);\n }\n });\n this.dispatchDisplayedRowsChanged(false);\n }\n }\n getCellRendererInstances(params) {\n var _a;\n const cellRenderers = this.getCellCtrls(params.rowNodes, params.columns)\n .map(cellCtrl => cellCtrl.getCellRenderer())\n .filter(renderer => renderer != null);\n if ((_a = params.columns) === null || _a === void 0 ? void 0 : _a.length) {\n return cellRenderers;\n }\n const fullWidthRenderers = [];\n const rowIdMap = this.mapRowNodes(params.rowNodes);\n this.getAllRowCtrls().forEach(rowCtrl => {\n if (rowIdMap && !this.isRowInMap(rowCtrl.getRowNode(), rowIdMap)) {\n return;\n }\n if (!rowCtrl.isFullWidth()) {\n return;\n }\n const fullWidthRenderer = rowCtrl.getFullWidthCellRenderer();\n if (fullWidthRenderer) {\n fullWidthRenderers.push(fullWidthRenderer);\n }\n });\n return [...fullWidthRenderers, ...cellRenderers];\n }\n getCellEditorInstances(params) {\n const res = [];\n this.getCellCtrls(params.rowNodes, params.columns).forEach(cellCtrl => {\n const cellEditor = cellCtrl.getCellEditor();\n if (cellEditor) {\n res.push(cellEditor);\n }\n });\n return res;\n }\n getEditingCells() {\n const res = [];\n this.getAllCellCtrls().forEach(cellCtrl => {\n if (cellCtrl.isEditing()) {\n const cellPosition = cellCtrl.getCellPosition();\n res.push(cellPosition);\n }\n });\n return res;\n }\n mapRowNodes(rowNodes) {\n if (!rowNodes) {\n return;\n }\n const res = {\n top: {},\n bottom: {},\n normal: {}\n };\n rowNodes.forEach(rowNode => {\n const id = rowNode.id;\n if (rowNode.rowPinned === 'top') {\n res.top[id] = rowNode;\n }\n else if (rowNode.rowPinned === 'bottom') {\n res.bottom[id] = rowNode;\n }\n else {\n res.normal[id] = rowNode;\n }\n });\n return res;\n }\n isRowInMap(rowNode, rowIdsMap) {\n // skip this row if it is missing from the provided list\n const id = rowNode.id;\n const floating = rowNode.rowPinned;\n if (floating === 'bottom') {\n return rowIdsMap.bottom[id] != null;\n }\n if (floating === 'top') {\n return rowIdsMap.top[id] != null;\n }\n return rowIdsMap.normal[id] != null;\n }\n /**\n * @param rowNodes if provided, returns the RowCtrls for the provided rowNodes. otherwise returns all RowCtrls.\n */\n getRowCtrls(rowNodes) {\n const rowIdsMap = this.mapRowNodes(rowNodes);\n const allRowCtrls = this.getAllRowCtrls();\n if (!rowNodes || !rowIdsMap) {\n return allRowCtrls;\n }\n return allRowCtrls.filter(rowCtrl => {\n const rowNode = rowCtrl.getRowNode();\n return this.isRowInMap(rowNode, rowIdsMap);\n });\n }\n // returns CellCtrl's that match the provided rowNodes and columns. eg if one row node\n // and two columns provided, that identifies 4 cells, so 4 CellCtrl's returned.\n getCellCtrls(rowNodes, columns) {\n let colIdsMap;\n if (exists(columns)) {\n colIdsMap = {};\n columns.forEach((colKey) => {\n const column = this.columnModel.getGridColumn(colKey);\n if (exists(column)) {\n colIdsMap[column.getId()] = true;\n }\n });\n }\n const res = [];\n this.getRowCtrls(rowNodes).forEach(rowCtrl => {\n rowCtrl.getAllCellCtrls().forEach(cellCtrl => {\n const colId = cellCtrl.getColumn().getId();\n const excludeColFromRefresh = colIdsMap && !colIdsMap[colId];\n if (excludeColFromRefresh) {\n return;\n }\n res.push(cellCtrl);\n });\n });\n return res;\n }\n destroy() {\n this.removeAllRowComps();\n super.destroy();\n }\n removeAllRowComps() {\n const rowIndexesToRemove = Object.keys(this.rowCtrlsByRowIndex);\n this.removeRowCtrls(rowIndexesToRemove);\n }\n getRowsToRecycle() {\n // remove all stub nodes, they can't be reused, as no rowNode id\n const stubNodeIndexes = [];\n iterateObject(this.rowCtrlsByRowIndex, (index, rowComp) => {\n const stubNode = rowComp.getRowNode().id == null;\n if (stubNode) {\n stubNodeIndexes.push(index);\n }\n });\n this.removeRowCtrls(stubNodeIndexes);\n // then clear out rowCompsByIndex, but before that take a copy, but index by id, not rowIndex\n const ctrlsByIdMap = {};\n iterateObject(this.rowCtrlsByRowIndex, (index, rowComp) => {\n const rowNode = rowComp.getRowNode();\n ctrlsByIdMap[rowNode.id] = rowComp;\n });\n this.rowCtrlsByRowIndex = {};\n return ctrlsByIdMap;\n }\n // takes array of row indexes\n removeRowCtrls(rowsToRemove) {\n // if no fromIndex then set to -1, which will refresh everything\n // let realFromIndex = -1;\n rowsToRemove.forEach(indexToRemove => {\n const rowCtrl = this.rowCtrlsByRowIndex[indexToRemove];\n if (rowCtrl) {\n rowCtrl.destroyFirstPass();\n rowCtrl.destroySecondPass();\n }\n delete this.rowCtrlsByRowIndex[indexToRemove];\n });\n }\n onBodyScroll(e) {\n if (e.direction !== 'vertical') {\n return;\n }\n this.redraw({ afterScroll: true });\n }\n // gets called when rows don't change, but viewport does, so after:\n // 1) height of grid body changes, ie number of displayed rows has changed\n // 2) grid scrolled to new position\n // 3) ensure index visible (which is a scroll)\n redraw(params = {}) {\n const { afterScroll } = params;\n let cellFocused;\n // only try to refocus cells shifting in and out of sticky container\n // if the browser supports focus ({ preventScroll })\n if (this.stickyRowFeature && browserSupportsPreventScroll()) {\n cellFocused = this.getCellToRestoreFocusToAfterRefresh() || undefined;\n }\n const oldFirstRow = this.firstRenderedRow;\n const oldLastRow = this.lastRenderedRow;\n this.workOutFirstAndLastRowsToRender();\n let hasStickyRowChanges = false;\n if (this.stickyRowFeature) {\n hasStickyRowChanges = this.stickyRowFeature.checkStickyRows();\n }\n const rangeChanged = this.firstRenderedRow !== oldFirstRow || this.lastRenderedRow !== oldLastRow;\n if (afterScroll && !hasStickyRowChanges && !rangeChanged) {\n return;\n }\n this.getLockOnRefresh();\n this.recycleRows(null, false, afterScroll);\n this.releaseLockOnRefresh();\n this.dispatchDisplayedRowsChanged(afterScroll);\n if (cellFocused != null) {\n const newFocusedCell = this.getCellToRestoreFocusToAfterRefresh();\n if (cellFocused != null && newFocusedCell == null) {\n this.animationFrameService.flushAllFrames();\n this.restoreFocusedCell(cellFocused);\n }\n }\n }\n removeRowCompsNotToDraw(indexesToDraw) {\n // for speedy lookup, dump into map\n const indexesToDrawMap = {};\n indexesToDraw.forEach(index => (indexesToDrawMap[index] = true));\n const existingIndexes = Object.keys(this.rowCtrlsByRowIndex);\n const indexesNotToDraw = existingIndexes.filter(index => !indexesToDrawMap[index]);\n this.removeRowCtrls(indexesNotToDraw);\n }\n calculateIndexesToDraw(rowsToRecycle) {\n // all in all indexes in the viewport\n let indexesToDraw = createArrayOfNumbers(this.firstRenderedRow, this.lastRenderedRow);\n const checkRowToDraw = (indexStr, rowComp) => {\n const index = rowComp.getRowNode().rowIndex;\n if (index == null) {\n return;\n }\n if (index < this.firstRenderedRow || index > this.lastRenderedRow) {\n if (this.doNotUnVirtualiseRow(rowComp)) {\n indexesToDraw.push(index);\n }\n }\n };\n // if we are redrawing due to scrolling change, then old rows are in this.rowCompsByIndex\n iterateObject(this.rowCtrlsByRowIndex, checkRowToDraw);\n // if we are redrawing due to model update, then old rows are in rowsToRecycle\n iterateObject(rowsToRecycle, checkRowToDraw);\n indexesToDraw.sort((a, b) => a - b);\n const ret = [];\n for (let i = 0; i < indexesToDraw.length; i++) {\n const currRow = indexesToDraw[i];\n const rowNode = this.paginationProxy.getRow(currRow);\n if (rowNode && !rowNode.sticky) {\n ret.push(currRow);\n }\n }\n return ret;\n }\n recycleRows(rowsToRecycle, animate = false, afterScroll = false) {\n // the row can already exist and be in the following:\n // rowsToRecycle -> if model change, then the index may be different, however row may\n // exist here from previous time (mapped by id).\n // this.rowCompsByIndex -> if just a scroll, then this will contain what is currently in the viewport\n // this is all the indexes we want, including those that already exist, so this method\n // will end up going through each index and drawing only if the row doesn't already exist\n const indexesToDraw = this.calculateIndexesToDraw(rowsToRecycle);\n this.removeRowCompsNotToDraw(indexesToDraw);\n // never animate when doing print layout - as we want to get things ready to print as quickly as possible,\n // otherwise we risk the printer printing a row that's half faded (half way through fading in)\n if (this.printLayout) {\n animate = false;\n }\n // add in new rows\n const rowCtrls = [];\n indexesToDraw.forEach(rowIndex => {\n const rowCtrl = this.createOrUpdateRowCtrl(rowIndex, rowsToRecycle, animate, afterScroll);\n if (exists(rowCtrl)) {\n rowCtrls.push(rowCtrl);\n }\n });\n if (rowsToRecycle) {\n const useAnimationFrame = afterScroll && !this.gridOptionsService.is('suppressAnimationFrame') && !this.printLayout;\n if (useAnimationFrame) {\n this.beans.animationFrameService.addDestroyTask(() => {\n this.destroyRowCtrls(rowsToRecycle, animate);\n this.updateAllRowCtrls();\n this.dispatchDisplayedRowsChanged();\n });\n }\n else {\n this.destroyRowCtrls(rowsToRecycle, animate);\n }\n }\n this.updateAllRowCtrls();\n }\n dispatchDisplayedRowsChanged(afterScroll = false) {\n const event = { type: Events.EVENT_DISPLAYED_ROWS_CHANGED, afterScroll };\n this.eventService.dispatchEvent(event);\n }\n onDisplayedColumnsChanged() {\n const pinningLeft = this.columnModel.isPinningLeft();\n const pinningRight = this.columnModel.isPinningRight();\n const atLeastOneChanged = this.pinningLeft !== pinningLeft || pinningRight !== this.pinningRight;\n if (atLeastOneChanged) {\n this.pinningLeft = pinningLeft;\n this.pinningRight = pinningRight;\n if (this.embedFullWidthRows) {\n this.redrawFullWidthEmbeddedRows();\n }\n }\n }\n // when embedding, what gets showed in each section depends on what is pinned. eg if embedding group expand / collapse,\n // then it should go into the pinned left area if pinning left, or the center area if not pinning.\n redrawFullWidthEmbeddedRows() {\n // if either of the pinned panels has shown / hidden, then need to redraw the fullWidth bits when\n // embedded, as what appears in each section depends on whether we are pinned or not\n const rowsToRemove = [];\n this.getFullWidthRowCtrls().forEach(fullWidthCtrl => {\n const rowIndex = fullWidthCtrl.getRowNode().rowIndex;\n rowsToRemove.push(rowIndex.toString());\n });\n this.refreshFloatingRowComps();\n this.removeRowCtrls(rowsToRemove);\n this.redraw({ afterScroll: true });\n }\n getFullWidthRowCtrls(rowNodes) {\n const rowNodesMap = this.mapRowNodes(rowNodes);\n return this.getAllRowCtrls().filter((rowCtrl) => {\n // include just full width\n if (!rowCtrl.isFullWidth()) {\n return false;\n }\n // if Row Nodes provided, we exclude where Row Node is missing\n const rowNode = rowCtrl.getRowNode();\n if (rowNodesMap != null && !this.isRowInMap(rowNode, rowNodesMap)) {\n return false;\n }\n return true;\n });\n }\n createOrUpdateRowCtrl(rowIndex, rowsToRecycle, animate, afterScroll) {\n let rowNode;\n let rowCtrl = this.rowCtrlsByRowIndex[rowIndex];\n // if no row comp, see if we can get it from the previous rowComps\n if (!rowCtrl) {\n rowNode = this.paginationProxy.getRow(rowIndex);\n if (exists(rowNode) && exists(rowsToRecycle) && rowsToRecycle[rowNode.id] && rowNode.alreadyRendered) {\n rowCtrl = rowsToRecycle[rowNode.id];\n rowsToRecycle[rowNode.id] = null;\n }\n }\n const creatingNewRowCtrl = !rowCtrl;\n if (creatingNewRowCtrl) {\n // create a new one\n if (!rowNode) {\n rowNode = this.paginationProxy.getRow(rowIndex);\n }\n if (exists(rowNode)) {\n rowCtrl = this.createRowCon(rowNode, animate, afterScroll);\n }\n else {\n // this should never happen - if somehow we are trying to create\n // a row for a rowNode that does not exist.\n return;\n }\n }\n if (rowNode) {\n // set node as 'alreadyRendered' to ensure we only recycle rowComps that have been rendered, this ensures\n // we don't reuse rowComps that have been removed and then re-added in the same batch transaction.\n rowNode.alreadyRendered = true;\n }\n this.rowCtrlsByRowIndex[rowIndex] = rowCtrl;\n return rowCtrl;\n }\n destroyRowCtrls(rowCtrlsMap, animate) {\n const executeInAWhileFuncs = [];\n iterateObject(rowCtrlsMap, (nodeId, rowCtrl) => {\n // if row was used, then it's null\n if (!rowCtrl) {\n return;\n }\n if (this.cachedRowCtrls && rowCtrl.isCacheable()) {\n this.cachedRowCtrls.addRow(rowCtrl);\n return;\n }\n rowCtrl.destroyFirstPass();\n if (animate) {\n this.zombieRowCtrls[rowCtrl.getInstanceId()] = rowCtrl;\n executeInAWhileFuncs.push(() => {\n rowCtrl.destroySecondPass();\n delete this.zombieRowCtrls[rowCtrl.getInstanceId()];\n });\n }\n else {\n rowCtrl.destroySecondPass();\n }\n });\n if (animate) {\n // this ensures we fire displayedRowsChanged AFTER all the 'executeInAWhileFuncs' get\n // executed, as we added it to the end of the list.\n executeInAWhileFuncs.push(() => {\n this.updateAllRowCtrls();\n this.dispatchDisplayedRowsChanged();\n });\n executeInAWhile(executeInAWhileFuncs);\n }\n }\n getRowBuffer() {\n let rowBuffer = this.gridOptionsService.getNum('rowBuffer');\n if (typeof rowBuffer === 'number') {\n if (rowBuffer < 0) {\n doOnce(() => console.warn(`AG Grid: rowBuffer should not be negative`), 'warn rowBuffer negative');\n rowBuffer = 0;\n this.gridOptionsService.set('rowBuffer', 0);\n }\n }\n else {\n rowBuffer = 10;\n }\n return rowBuffer;\n }\n getRowBufferInPixels() {\n const rowsToBuffer = this.getRowBuffer();\n const defaultRowHeight = this.gridOptionsService.getRowHeightAsNumber();\n return rowsToBuffer * defaultRowHeight;\n }\n workOutFirstAndLastRowsToRender() {\n this.rowContainerHeightService.updateOffset();\n let newFirst;\n let newLast;\n if (!this.paginationProxy.isRowsToRender()) {\n newFirst = 0;\n newLast = -1; // setting to -1 means nothing in range\n }\n else if (this.printLayout) {\n newFirst = this.paginationProxy.getPageFirstRow();\n newLast = this.paginationProxy.getPageLastRow();\n }\n else {\n const bufferPixels = this.getRowBufferInPixels();\n const gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();\n const suppressRowVirtualisation = this.gridOptionsService.is('suppressRowVirtualisation');\n let rowHeightsChanged = false;\n let firstPixel;\n let lastPixel;\n do {\n const paginationOffset = this.paginationProxy.getPixelOffset();\n const { pageFirstPixel, pageLastPixel } = this.paginationProxy.getCurrentPagePixelRange();\n const divStretchOffset = this.rowContainerHeightService.getDivStretchOffset();\n const bodyVRange = gridBodyCtrl.getScrollFeature().getVScrollPosition();\n const bodyTopPixel = bodyVRange.top;\n const bodyBottomPixel = bodyVRange.bottom;\n if (suppressRowVirtualisation) {\n firstPixel = pageFirstPixel + divStretchOffset;\n lastPixel = pageLastPixel + divStretchOffset;\n }\n else {\n firstPixel = Math.max(bodyTopPixel + paginationOffset - bufferPixels, pageFirstPixel) + divStretchOffset;\n lastPixel = Math.min(bodyBottomPixel + paginationOffset + bufferPixels, pageLastPixel) + divStretchOffset;\n }\n this.firstVisibleVPixel = Math.max(bodyTopPixel + paginationOffset, pageFirstPixel) + divStretchOffset;\n // if the rows we are about to display get their heights changed, then that upsets the calcs from above.\n rowHeightsChanged = this.ensureAllRowsInRangeHaveHeightsCalculated(firstPixel, lastPixel);\n } while (rowHeightsChanged);\n let firstRowIndex = this.paginationProxy.getRowIndexAtPixel(firstPixel);\n let lastRowIndex = this.paginationProxy.getRowIndexAtPixel(lastPixel);\n const pageFirstRow = this.paginationProxy.getPageFirstRow();\n const pageLastRow = this.paginationProxy.getPageLastRow();\n // adjust, in case buffer extended actual size\n if (firstRowIndex < pageFirstRow) {\n firstRowIndex = pageFirstRow;\n }\n if (lastRowIndex > pageLastRow) {\n lastRowIndex = pageLastRow;\n }\n newFirst = firstRowIndex;\n newLast = lastRowIndex;\n }\n // sometimes user doesn't set CSS right and ends up with grid with no height and grid ends up\n // trying to render all the rows, eg 10,000+ rows. this will kill the browser. so instead of\n // killing the browser, we limit the number of rows. just in case some use case we didn't think\n // of, we also have a property to not do this operation.\n const rowLayoutNormal = this.gridOptionsService.isDomLayout('normal');\n const suppressRowCountRestriction = this.gridOptionsService.is('suppressMaxRenderedRowRestriction');\n const rowBufferMaxSize = Math.max(this.getRowBuffer(), 500);\n if (rowLayoutNormal && !suppressRowCountRestriction) {\n if (newLast - newFirst > rowBufferMaxSize) {\n newLast = newFirst + rowBufferMaxSize;\n }\n }\n const firstDiffers = newFirst !== this.firstRenderedRow;\n const lastDiffers = newLast !== this.lastRenderedRow;\n if (firstDiffers || lastDiffers) {\n this.firstRenderedRow = newFirst;\n this.lastRenderedRow = newLast;\n const event = {\n type: Events.EVENT_VIEWPORT_CHANGED,\n firstRow: newFirst,\n lastRow: newLast\n };\n this.eventService.dispatchEvent(event);\n }\n }\n /**\n * This event will only be fired once, and is queued until after the browser next renders.\n * This allows us to fire an event during the start of the render cycle, when we first see data being rendered\n * but not execute the event until all of the data has finished being rendered to the dom.\n */\n dispatchFirstDataRenderedEvent() {\n if (this.dataFirstRenderedFired) {\n return;\n }\n this.dataFirstRenderedFired = true;\n const event = {\n type: Events.EVENT_FIRST_DATA_RENDERED,\n firstRow: this.firstRenderedRow,\n lastRow: this.lastRenderedRow,\n };\n // See AG-7018\n window.requestAnimationFrame(() => {\n this.beans.eventService.dispatchEvent(event);\n });\n }\n ensureAllRowsInRangeHaveHeightsCalculated(topPixel, bottomPixel) {\n // ensureRowHeightsVisible only works with CSRM, as it's the only row model that allows lazy row height calcs.\n // all the other row models just hard code so the method just returns back false\n const res = this.paginationProxy.ensureRowHeightsValid(topPixel, bottomPixel, -1, -1);\n if (res) {\n this.updateContainerHeights();\n }\n return res;\n }\n getFirstVisibleVerticalPixel() {\n return this.firstVisibleVPixel;\n }\n getFirstVirtualRenderedRow() {\n return this.firstRenderedRow;\n }\n getLastVirtualRenderedRow() {\n return this.lastRenderedRow;\n }\n // check that none of the rows to remove are editing or focused as:\n // a) if editing, we want to keep them, otherwise the user will loose the context of the edit,\n // eg user starts editing, enters some text, then scrolls down and then up, next time row rendered\n // the edit is reset - so we want to keep it rendered.\n // b) if focused, we want ot keep keyboard focus, so if user ctrl+c, it goes to clipboard,\n // otherwise the user can range select and drag (with focus cell going out of the viewport)\n // and then ctrl+c, nothing will happen if cell is removed from dom.\n // c) if detail record of master detail, as users complained that the context of detail rows\n // was getting lost when detail row out of view. eg user expands to show detail row,\n // then manipulates the detail panel (eg sorts the detail grid), then context is lost\n // after detail panel is scrolled out of / into view.\n doNotUnVirtualiseRow(rowComp) {\n const REMOVE_ROW = false;\n const KEEP_ROW = true;\n const rowNode = rowComp.getRowNode();\n const rowHasFocus = this.focusService.isRowNodeFocused(rowNode);\n const rowIsEditing = rowComp.isEditing();\n const rowIsDetail = rowNode.detail;\n const mightWantToKeepRow = rowHasFocus || rowIsEditing || rowIsDetail;\n // if we deffo don't want to keep it,\n if (!mightWantToKeepRow) {\n return REMOVE_ROW;\n }\n // editing row, only remove if it is no longer rendered, eg filtered out or new data set.\n // the reason we want to keep is if user is scrolling up and down, we don't want to loose\n // the context of the editing in process.\n const rowNodePresent = this.paginationProxy.isRowPresent(rowNode);\n return rowNodePresent ? KEEP_ROW : REMOVE_ROW;\n }\n createRowCon(rowNode, animate, afterScroll) {\n const rowCtrlFromCache = this.cachedRowCtrls ? this.cachedRowCtrls.getRow(rowNode) : null;\n if (rowCtrlFromCache) {\n return rowCtrlFromCache;\n }\n // we don't use animations frames for printing, so the user can put the grid into print mode\n // and immediately print - otherwise the user would have to wait for the rows to draw in the background\n // (via the animation frames) which is awkward to do from code.\n // we only do the animation frames after scrolling, as this is where we want the smooth user experience.\n // having animation frames for other times makes the grid look 'jumpy'.\n const suppressAnimationFrame = this.gridOptionsService.is('suppressAnimationFrame');\n const useAnimationFrameForCreate = afterScroll && !suppressAnimationFrame && !this.printLayout;\n const res = new RowCtrl(rowNode, this.beans, animate, useAnimationFrameForCreate, this.printLayout);\n return res;\n }\n getRenderedNodes() {\n const renderedRows = this.rowCtrlsByRowIndex;\n return Object.keys(renderedRows).map(key => renderedRows[key].getRowNode());\n }\n getRowByPosition(rowPosition) {\n let rowCtrl;\n const { rowIndex } = rowPosition;\n switch (rowPosition.rowPinned) {\n case 'top':\n rowCtrl = this.topRowCtrls[rowIndex];\n break;\n case 'bottom':\n rowCtrl = this.bottomRowCtrls[rowIndex];\n break;\n default:\n rowCtrl = this.rowCtrlsByRowIndex[rowIndex];\n if (!rowCtrl) {\n rowCtrl = this.getStickyTopRowCtrls().find(ctrl => ctrl.getRowNode().rowIndex === rowIndex) || null;\n }\n break;\n }\n return rowCtrl;\n }\n getRowNode(gridRow) {\n switch (gridRow.rowPinned) {\n case 'top':\n return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];\n case 'bottom':\n return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];\n default:\n return this.rowModel.getRow(gridRow.rowIndex);\n }\n }\n // returns true if any row between startIndex and endIndex is rendered. used by\n // SSRM or IRM, as they don't want to purge visible blocks from cache.\n isRangeInRenderedViewport(startIndex, endIndex) {\n // parent closed means the parent node is not expanded, thus these blocks are not visible\n const parentClosed = startIndex == null || endIndex == null;\n if (parentClosed) {\n return false;\n }\n const blockAfterViewport = startIndex > this.lastRenderedRow;\n const blockBeforeViewport = endIndex < this.firstRenderedRow;\n const blockInsideViewport = !blockBeforeViewport && !blockAfterViewport;\n return blockInsideViewport;\n }\n};\n__decorate([\n Autowired(\"animationFrameService\")\n], RowRenderer.prototype, \"animationFrameService\", void 0);\n__decorate([\n Autowired(\"paginationProxy\")\n], RowRenderer.prototype, \"paginationProxy\", void 0);\n__decorate([\n Autowired(\"columnModel\")\n], RowRenderer.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired(\"pinnedRowModel\")\n], RowRenderer.prototype, \"pinnedRowModel\", void 0);\n__decorate([\n Autowired(\"rowModel\")\n], RowRenderer.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired(\"focusService\")\n], RowRenderer.prototype, \"focusService\", void 0);\n__decorate([\n Autowired(\"beans\")\n], RowRenderer.prototype, \"beans\", void 0);\n__decorate([\n Autowired(\"rowContainerHeightService\")\n], RowRenderer.prototype, \"rowContainerHeightService\", void 0);\n__decorate([\n Autowired(\"ctrlsService\")\n], RowRenderer.prototype, \"ctrlsService\", void 0);\n__decorate([\n PostConstruct\n], RowRenderer.prototype, \"postConstruct\", null);\nRowRenderer = __decorate([\n Bean(\"rowRenderer\")\n], RowRenderer);\nexport { RowRenderer };\nclass RowCtrlCache {\n constructor(maxCount) {\n // map for fast access\n this.entriesMap = {};\n // list for keeping order\n this.entriesList = [];\n this.maxCount = maxCount;\n }\n addRow(rowCtrl) {\n this.entriesMap[rowCtrl.getRowNode().id] = rowCtrl;\n this.entriesList.push(rowCtrl);\n rowCtrl.setCached(true);\n if (this.entriesList.length > this.maxCount) {\n const rowCtrlToDestroy = this.entriesList[0];\n rowCtrlToDestroy.destroyFirstPass();\n rowCtrlToDestroy.destroySecondPass();\n this.removeFromCache(rowCtrlToDestroy);\n }\n }\n getRow(rowNode) {\n if (rowNode == null || rowNode.id == null) {\n return null;\n }\n const res = this.entriesMap[rowNode.id];\n if (!res) {\n return null;\n }\n this.removeFromCache(res);\n res.setCached(false);\n // this can happen if user reloads data, and a new RowNode is reusing\n // the same ID as the old one\n const rowNodeMismatch = res.getRowNode() != rowNode;\n return rowNodeMismatch ? null : res;\n }\n removeFromCache(rowCtrl) {\n const rowNodeId = rowCtrl.getRowNode().id;\n delete this.entriesMap[rowNodeId];\n removeFromArray(this.entriesList, rowCtrl);\n }\n getEntries() {\n return this.entriesList;\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean, Autowired } from '../context/context.mjs';\nimport { BeanStub } from \"../context/beanStub.mjs\";\nlet ValueFormatterService = class ValueFormatterService extends BeanStub {\n formatValue(column, node, value, suppliedFormatter, useFormatterFromColumn = true) {\n let result = null;\n let formatter;\n const colDef = column.getColDef();\n if (suppliedFormatter) {\n // use supplied formatter if provided, e.g. set filter items can have their own value formatters\n formatter = suppliedFormatter;\n }\n else if (useFormatterFromColumn) {\n formatter = colDef.valueFormatter;\n }\n if (formatter) {\n const params = {\n value,\n node,\n data: node ? node.data : null,\n colDef,\n column,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context\n };\n if (typeof formatter === 'function') {\n result = formatter(params);\n }\n else {\n result = this.expressionService.evaluate(formatter, params);\n }\n }\n else if (colDef.refData) {\n return colDef.refData[value] || '';\n }\n // if we don't do this, then arrays get displayed as 1,2,3, but we want 1, 2, 3 (i.e. with spaces)\n if (result == null && Array.isArray(value)) {\n result = value.join(', ');\n }\n return result;\n }\n};\n__decorate([\n Autowired('expressionService')\n], ValueFormatterService.prototype, \"expressionService\", void 0);\nValueFormatterService = __decorate([\n Bean('valueFormatterService')\n], ValueFormatterService);\nexport { ValueFormatterService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { RowNode } from \"../entities/rowNode.mjs\";\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { Events } from \"../events.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { missingOrEmpty } from \"../utils/generic.mjs\";\nimport { last } from \"../utils/array.mjs\";\nlet PinnedRowModel = class PinnedRowModel extends BeanStub {\n init() {\n this.setPinnedTopRowData(this.gridOptionsService.get('pinnedTopRowData'));\n this.setPinnedBottomRowData(this.gridOptionsService.get('pinnedBottomRowData'));\n }\n isEmpty(floating) {\n const rows = floating === 'top' ? this.pinnedTopRows : this.pinnedBottomRows;\n return missingOrEmpty(rows);\n }\n isRowsToRender(floating) {\n return !this.isEmpty(floating);\n }\n getRowAtPixel(pixel, floating) {\n const rows = floating === 'top' ? this.pinnedTopRows : this.pinnedBottomRows;\n if (missingOrEmpty(rows)) {\n return 0; // this should never happen, just in case, 0 is graceful failure\n }\n for (let i = 0; i < rows.length; i++) {\n const rowNode = rows[i];\n const rowTopPixel = rowNode.rowTop + rowNode.rowHeight - 1;\n // only need to range check against the top pixel, as we are going through the list\n // in order, first row to hit the pixel wins\n if (rowTopPixel >= pixel) {\n return i;\n }\n }\n return rows.length - 1;\n }\n setPinnedTopRowData(rowData) {\n this.pinnedTopRows = this.createNodesFromData(rowData, true);\n const event = {\n type: Events.EVENT_PINNED_ROW_DATA_CHANGED\n };\n this.eventService.dispatchEvent(event);\n }\n setPinnedBottomRowData(rowData) {\n this.pinnedBottomRows = this.createNodesFromData(rowData, false);\n const event = {\n type: Events.EVENT_PINNED_ROW_DATA_CHANGED\n };\n this.eventService.dispatchEvent(event);\n }\n createNodesFromData(allData, isTop) {\n const rowNodes = [];\n if (allData) {\n let nextRowTop = 0;\n allData.forEach((dataItem, index) => {\n const rowNode = new RowNode(this.beans);\n rowNode.data = dataItem;\n const idPrefix = isTop ? RowNode.ID_PREFIX_TOP_PINNED : RowNode.ID_PREFIX_BOTTOM_PINNED;\n rowNode.id = idPrefix + index;\n rowNode.rowPinned = isTop ? 'top' : 'bottom';\n rowNode.setRowTop(nextRowTop);\n rowNode.setRowHeight(this.gridOptionsService.getRowHeightForNode(rowNode).height);\n rowNode.setRowIndex(index);\n nextRowTop += rowNode.rowHeight;\n rowNodes.push(rowNode);\n });\n }\n return rowNodes;\n }\n getPinnedTopRowData() {\n return this.pinnedTopRows;\n }\n getPinnedBottomRowData() {\n return this.pinnedBottomRows;\n }\n getPinnedTopTotalHeight() {\n return this.getTotalHeight(this.pinnedTopRows);\n }\n getPinnedTopRowCount() {\n return this.pinnedTopRows ? this.pinnedTopRows.length : 0;\n }\n getPinnedBottomRowCount() {\n return this.pinnedBottomRows ? this.pinnedBottomRows.length : 0;\n }\n getPinnedTopRow(index) {\n return this.pinnedTopRows[index];\n }\n getPinnedBottomRow(index) {\n return this.pinnedBottomRows[index];\n }\n forEachPinnedTopRow(callback) {\n if (missingOrEmpty(this.pinnedTopRows)) {\n return;\n }\n this.pinnedTopRows.forEach(callback);\n }\n forEachPinnedBottomRow(callback) {\n if (missingOrEmpty(this.pinnedBottomRows)) {\n return;\n }\n this.pinnedBottomRows.forEach(callback);\n }\n getPinnedBottomTotalHeight() {\n return this.getTotalHeight(this.pinnedBottomRows);\n }\n getTotalHeight(rowNodes) {\n if (!rowNodes || rowNodes.length === 0) {\n return 0;\n }\n const lastNode = last(rowNodes);\n return lastNode.rowTop + lastNode.rowHeight;\n }\n};\n__decorate([\n Autowired('beans')\n], PinnedRowModel.prototype, \"beans\", void 0);\n__decorate([\n PostConstruct\n], PinnedRowModel.prototype, \"init\", null);\nPinnedRowModel = __decorate([\n Bean('pinnedRowModel')\n], PinnedRowModel);\nexport { PinnedRowModel };\n","export var ServerSideTransactionResultStatus;\n(function (ServerSideTransactionResultStatus) {\n /** Transaction was successfully applied */\n ServerSideTransactionResultStatus[\"Applied\"] = \"Applied\";\n /**\n * Store was not found, transaction not applied.\n * Either invalid route, or the parent row has not yet been expanded.\n */\n ServerSideTransactionResultStatus[\"StoreNotFound\"] = \"StoreNotFound\";\n /**\n * Store is loading, transaction not applied.\n */\n ServerSideTransactionResultStatus[\"StoreLoading\"] = \"StoreLoading\";\n /**\n * Store is loading (as max loads exceeded), transaction not applied.\n */\n ServerSideTransactionResultStatus[\"StoreWaitingToLoad\"] = \"StoreWaitingToLoad\";\n /**\n * Store load attempt failed, transaction not applied.\n */\n ServerSideTransactionResultStatus[\"StoreLoadingFailed\"] = \"StoreLoadingFailed\";\n /**\n * Store is type Partial, which doesn't accept transactions\n */\n ServerSideTransactionResultStatus[\"StoreWrongType\"] = \"StoreWrongType\";\n /**\n * Transaction was cancelled, due to grid.\n * Callback isApplyServerSideTransaction() returning false\n */\n ServerSideTransactionResultStatus[\"Cancelled\"] = \"Cancelled\";\n})(ServerSideTransactionResultStatus || (ServerSideTransactionResultStatus = {}));\n","// when doing transactions, or change detection, and grouping is present\n// in the data, there is no need for the ClientSideRowModel to update each\n// group after an update, ony parts that were impacted by the change.\n// this class keeps track of all groups that were impacted by a transaction.\n// the the different CSRM operations (filter, sort etc) use the forEach method\n// to visit each group that was changed.\nexport class ChangedPath {\n constructor(keepingColumns, rootNode) {\n // whether changed path is active of not. it is active when a) doing\n // a transaction update or b) doing change detection. if we are doing\n // a CSRM refresh for other reasons (after sort or filter, or user calling\n // setRowData() without delta mode) then we are not active. we are also\n // marked as not active if secondary columns change in pivot (as this impacts\n // aggregations)\n this.active = true;\n // for each node in the change path, we also store which columns need\n // to be re-aggregated.\n this.nodeIdsToColumns = {};\n // for quick lookup, all items in the change path are mapped by nodeId\n this.mapToItems = {};\n this.keepingColumns = keepingColumns;\n this.pathRoot = {\n rowNode: rootNode,\n children: null\n };\n this.mapToItems[rootNode.id] = this.pathRoot;\n }\n // can be set inactive by:\n // a) ClientSideRowModel, if no transactions or\n // b) PivotService, if secondary columns changed\n setInactive() {\n this.active = false;\n }\n isActive() {\n return this.active;\n }\n depthFirstSearchChangedPath(pathItem, callback) {\n if (pathItem.children) {\n for (let i = 0; i < pathItem.children.length; i++) {\n this.depthFirstSearchChangedPath(pathItem.children[i], callback);\n }\n }\n callback(pathItem.rowNode);\n }\n depthFirstSearchEverything(rowNode, callback, traverseEverything) {\n if (rowNode.childrenAfterGroup) {\n for (let i = 0; i < rowNode.childrenAfterGroup.length; i++) {\n const childNode = rowNode.childrenAfterGroup[i];\n if (childNode.childrenAfterGroup) {\n this.depthFirstSearchEverything(rowNode.childrenAfterGroup[i], callback, traverseEverything);\n }\n else if (traverseEverything) {\n callback(childNode);\n }\n }\n }\n callback(rowNode);\n }\n // traverseLeafNodes -> used when NOT doing changed path, ie traversing everything. the callback\n // will be called for child nodes in addition to parent nodes.\n forEachChangedNodeDepthFirst(callback, traverseLeafNodes = false, includeUnchangedNodes = false) {\n if (this.active && !includeUnchangedNodes) {\n // if we are active, then use the change path to callback\n // only for updated groups\n this.depthFirstSearchChangedPath(this.pathRoot, callback);\n }\n else {\n // we are not active, so callback for everything, walk the entire path\n this.depthFirstSearchEverything(this.pathRoot.rowNode, callback, traverseLeafNodes);\n }\n }\n executeFromRootNode(callback) {\n callback(this.pathRoot.rowNode);\n }\n createPathItems(rowNode) {\n let pointer = rowNode;\n let newEntryCount = 0;\n while (!this.mapToItems[pointer.id]) {\n const newEntry = {\n rowNode: pointer,\n children: null\n };\n this.mapToItems[pointer.id] = newEntry;\n newEntryCount++;\n pointer = pointer.parent;\n }\n return newEntryCount;\n }\n populateColumnsMap(rowNode, columns) {\n if (!this.keepingColumns || !columns) {\n return;\n }\n let pointer = rowNode;\n while (pointer) {\n // if columns, add the columns in all the way to parent, merging\n // in any other columns that might be there already\n if (!this.nodeIdsToColumns[pointer.id]) {\n this.nodeIdsToColumns[pointer.id] = {};\n }\n columns.forEach(col => this.nodeIdsToColumns[pointer.id][col.getId()] = true);\n pointer = pointer.parent;\n }\n }\n linkPathItems(rowNode, newEntryCount) {\n let pointer = rowNode;\n for (let i = 0; i < newEntryCount; i++) {\n const thisItem = this.mapToItems[pointer.id];\n const parentItem = this.mapToItems[pointer.parent.id];\n if (!parentItem.children) {\n parentItem.children = [];\n }\n parentItem.children.push(thisItem);\n pointer = pointer.parent;\n }\n }\n // called by\n // 1) change detection (provides cols) and\n // 2) groupStage if doing transaction update (doesn't provide cols)\n addParentNode(rowNode, columns) {\n if (!rowNode || rowNode.isRowPinned()) {\n return;\n }\n // we cannot do both steps below in the same loop as\n // the second loop has a dependency on the first loop.\n // ie the hierarchy cannot be stitched up yet because\n // we don't have it built yet\n // create the new PathItem objects.\n const newEntryCount = this.createPathItems(rowNode);\n // link in the node items\n this.linkPathItems(rowNode, newEntryCount);\n // update columns\n this.populateColumnsMap(rowNode, columns);\n }\n canSkip(rowNode) {\n return this.active && !this.mapToItems[rowNode.id];\n }\n getValueColumnsForNode(rowNode, valueColumns) {\n if (!this.keepingColumns) {\n return valueColumns;\n }\n const colsForThisNode = this.nodeIdsToColumns[rowNode.id];\n const result = valueColumns.filter(col => colsForThisNode[col.getId()]);\n return result;\n }\n getNotValueColumnsForNode(rowNode, valueColumns) {\n if (!this.keepingColumns) {\n return null;\n }\n const colsForThisNode = this.nodeIdsToColumns[rowNode.id];\n const result = valueColumns.filter(col => !colsForThisNode[col.getId()]);\n return result;\n }\n}\n","import { BeanStub } from \"../context/beanStub.mjs\";\nexport class RowNodeBlock extends BeanStub {\n constructor(id) {\n super();\n this.state = RowNodeBlock.STATE_WAITING_TO_LOAD;\n this.version = 0;\n this.id = id;\n }\n getId() {\n return this.id;\n }\n load() {\n this.state = RowNodeBlock.STATE_LOADING;\n this.loadFromDatasource();\n }\n getVersion() {\n return this.version;\n }\n setStateWaitingToLoad() {\n // in case any current loads in progress, this will have their results ignored\n this.version++;\n this.state = RowNodeBlock.STATE_WAITING_TO_LOAD;\n }\n getState() {\n return this.state;\n }\n pageLoadFailed(version) {\n const requestMostRecentAndLive = this.isRequestMostRecentAndLive(version);\n if (requestMostRecentAndLive) {\n this.state = RowNodeBlock.STATE_FAILED;\n this.processServerFail();\n }\n this.dispatchLoadCompleted(false);\n }\n success(version, params) {\n this.successCommon(version, params);\n }\n pageLoaded(version, rows, lastRow) {\n this.successCommon(version, { rowData: rows, rowCount: lastRow });\n }\n isRequestMostRecentAndLive(version) {\n // thisIsMostRecentRequest - if block was refreshed, then another request\n // could of been sent after this one.\n const thisIsMostRecentRequest = version === this.version;\n // weAreNotDestroyed - if InfiniteStore is purged, then blocks are destroyed\n // and new blocks created. so data loads of old blocks are discarded.\n const weAreNotDestroyed = this.isAlive();\n return thisIsMostRecentRequest && weAreNotDestroyed;\n }\n successCommon(version, params) {\n // need to dispatch load complete before processing the data, as PaginationComp checks\n // RowNodeBlockLoader to see if it is still loading, so the RowNodeBlockLoader needs to\n // be updated first (via LoadComplete event) before PaginationComp updates (via processServerResult method)\n this.dispatchLoadCompleted();\n const requestMostRecentAndLive = this.isRequestMostRecentAndLive(version);\n if (requestMostRecentAndLive) {\n this.state = RowNodeBlock.STATE_LOADED;\n this.processServerResult(params);\n }\n }\n dispatchLoadCompleted(success = true) {\n // we fire event regardless of processing data or now, as we want\n // the concurrentLoadRequests count to be reduced in BlockLoader\n const event = {\n type: RowNodeBlock.EVENT_LOAD_COMPLETE,\n success: success,\n block: this\n };\n this.dispatchEvent(event);\n }\n}\nRowNodeBlock.EVENT_LOAD_COMPLETE = 'loadComplete';\nRowNodeBlock.STATE_WAITING_TO_LOAD = 'needsLoading';\nRowNodeBlock.STATE_LOADING = 'loading';\nRowNodeBlock.STATE_LOADED = 'loaded';\nRowNodeBlock.STATE_FAILED = 'failed';\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar RowNodeBlockLoader_1;\nimport { RowNodeBlock } from \"./rowNodeBlock.mjs\";\nimport { Autowired, Bean, PostConstruct, Qualifier } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { _ } from \"../utils/index.mjs\";\nlet RowNodeBlockLoader = RowNodeBlockLoader_1 = class RowNodeBlockLoader extends BeanStub {\n constructor() {\n super(...arguments);\n this.activeBlockLoadsCount = 0;\n this.blocks = [];\n this.active = true;\n }\n postConstruct() {\n this.maxConcurrentRequests = this.getMaxConcurrentDatasourceRequests();\n const blockLoadDebounceMillis = this.gridOptionsService.getNum('blockLoadDebounceMillis');\n if (blockLoadDebounceMillis && blockLoadDebounceMillis > 0) {\n this.checkBlockToLoadDebounce = _.debounce(this.performCheckBlocksToLoad.bind(this), blockLoadDebounceMillis);\n }\n }\n setBeans(loggerFactory) {\n this.logger = loggerFactory.create('RowNodeBlockLoader');\n }\n getMaxConcurrentDatasourceRequests() {\n const res = this.gridOptionsService.getNum('maxConcurrentDatasourceRequests');\n if (res == null) {\n return 2;\n } // 2 is the default\n if (res <= 0) {\n return;\n } // negative number, eg -1, means no max restriction\n return res;\n }\n addBlock(block) {\n this.blocks.push(block);\n // note that we do not remove this listener when removing the block. this is because the\n // cache can get destroyed (and containing blocks) when a block is loading. however the loading block\n // is still counted as an active loading block and we must decrement activeBlockLoadsCount when it finishes.\n block.addEventListener(RowNodeBlock.EVENT_LOAD_COMPLETE, this.loadComplete.bind(this));\n this.checkBlockToLoad();\n }\n removeBlock(block) {\n _.removeFromArray(this.blocks, block);\n }\n destroy() {\n super.destroy();\n this.active = false;\n }\n loadComplete() {\n this.activeBlockLoadsCount--;\n this.checkBlockToLoad();\n this.dispatchEvent({ type: RowNodeBlockLoader_1.BLOCK_LOADED_EVENT });\n if (this.activeBlockLoadsCount == 0) {\n this.dispatchEvent({ type: RowNodeBlockLoader_1.BLOCK_LOADER_FINISHED_EVENT });\n }\n }\n checkBlockToLoad() {\n if (this.checkBlockToLoadDebounce) {\n this.checkBlockToLoadDebounce();\n }\n else {\n this.performCheckBlocksToLoad();\n }\n }\n performCheckBlocksToLoad() {\n if (!this.active) {\n return;\n }\n this.printCacheStatus();\n if (this.maxConcurrentRequests != null && this.activeBlockLoadsCount >= this.maxConcurrentRequests) {\n this.logger.log(`checkBlockToLoad: max loads exceeded`);\n return;\n }\n const loadAvailability = this.getAvailableLoadingCount();\n const blocksToLoad = this.blocks.filter(block => (block.getState() === RowNodeBlock.STATE_WAITING_TO_LOAD)).slice(0, loadAvailability);\n this.registerLoads(blocksToLoad.length);\n blocksToLoad.forEach(block => block.load());\n this.printCacheStatus();\n }\n getBlockState() {\n if (this.gridOptionsService.isRowModelType('serverSide')) {\n const ssrm = this.rowModel;\n return ssrm.getBlockStates();\n }\n const result = {};\n this.blocks.forEach((block) => {\n const { id, state } = block.getBlockStateJson();\n result[id] = state;\n });\n return result;\n }\n printCacheStatus() {\n if (this.logger.isLogging()) {\n this.logger.log(`printCacheStatus: activePageLoadsCount = ${this.activeBlockLoadsCount},`\n + ` blocks = ${JSON.stringify(this.getBlockState())}`);\n }\n }\n isLoading() {\n return this.activeBlockLoadsCount > 0;\n }\n registerLoads(count) {\n this.activeBlockLoadsCount += count;\n }\n getAvailableLoadingCount() {\n return this.maxConcurrentRequests !== undefined ? this.maxConcurrentRequests - this.activeBlockLoadsCount : undefined;\n }\n};\nRowNodeBlockLoader.BLOCK_LOADED_EVENT = 'blockLoaded';\nRowNodeBlockLoader.BLOCK_LOADER_FINISHED_EVENT = 'blockLoaderFinished';\n__decorate([\n Autowired('rowModel')\n], RowNodeBlockLoader.prototype, \"rowModel\", void 0);\n__decorate([\n PostConstruct\n], RowNodeBlockLoader.prototype, \"postConstruct\", null);\n__decorate([\n __param(0, Qualifier('loggerFactory'))\n], RowNodeBlockLoader.prototype, \"setBeans\", null);\nRowNodeBlockLoader = RowNodeBlockLoader_1 = __decorate([\n Bean('rowNodeBlockLoader')\n], RowNodeBlockLoader);\nexport { RowNodeBlockLoader };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Events } from \"../events.mjs\";\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { missing, exists } from \"../utils/generic.mjs\";\nlet PaginationProxy = class PaginationProxy extends BeanStub {\n constructor() {\n super(...arguments);\n this.currentPage = 0;\n this.topDisplayedRowIndex = 0;\n this.bottomDisplayedRowIndex = 0;\n this.pixelOffset = 0;\n this.masterRowCount = 0;\n }\n postConstruct() {\n this.active = this.gridOptionsService.is('pagination');\n this.paginateChildRows = this.isPaginateChildRows();\n this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, this.onModelUpdated.bind(this));\n this.addManagedPropertyListener('pagination', this.onPaginationPageSizeChanged.bind(this));\n this.addManagedPropertyListener('paginationPageSize', this.onPaginationPageSizeChanged.bind(this));\n this.onModelUpdated();\n }\n ensureRowHeightsValid(startPixel, endPixel, startLimitIndex, endLimitIndex) {\n const res = this.rowModel.ensureRowHeightsValid(startPixel, endPixel, this.getPageFirstRow(), this.getPageLastRow());\n if (res) {\n this.calculatePages();\n }\n return res;\n }\n isPaginateChildRows() {\n const shouldPaginate = this.gridOptionsService.is('groupRemoveSingleChildren') || this.gridOptionsService.is('groupRemoveLowestSingleChildren');\n if (shouldPaginate) {\n return true;\n }\n return this.gridOptionsService.is('paginateChildRows');\n }\n onModelUpdated(modelUpdatedEvent) {\n this.calculatePages();\n const paginationChangedEvent = {\n type: Events.EVENT_PAGINATION_CHANGED,\n animate: modelUpdatedEvent ? modelUpdatedEvent.animate : false,\n newData: modelUpdatedEvent ? modelUpdatedEvent.newData : false,\n newPage: modelUpdatedEvent ? modelUpdatedEvent.newPage : false,\n keepRenderedRows: modelUpdatedEvent ? modelUpdatedEvent.keepRenderedRows : false\n };\n this.eventService.dispatchEvent(paginationChangedEvent);\n }\n onPaginationPageSizeChanged() {\n this.active = this.gridOptionsService.is('pagination');\n this.calculatePages();\n const paginationChangedEvent = {\n type: Events.EVENT_PAGINATION_CHANGED,\n animate: false,\n newData: false,\n newPage: false,\n // important to keep rendered rows, otherwise every time grid is resized,\n // we would destroy all the rows.\n keepRenderedRows: true\n };\n this.eventService.dispatchEvent(paginationChangedEvent);\n }\n goToPage(page) {\n if (!this.active || this.currentPage === page || typeof this.currentPage !== 'number') {\n return;\n }\n this.currentPage = page;\n const event = {\n type: Events.EVENT_MODEL_UPDATED,\n animate: false,\n keepRenderedRows: false,\n newData: false,\n newPage: true\n };\n this.onModelUpdated(event);\n }\n getPixelOffset() {\n return this.pixelOffset;\n }\n getRow(index) {\n return this.rowModel.getRow(index);\n }\n getRowNode(id) {\n return this.rowModel.getRowNode(id);\n }\n getRowIndexAtPixel(pixel) {\n return this.rowModel.getRowIndexAtPixel(pixel);\n }\n getCurrentPageHeight() {\n if (missing(this.topRowBounds) || missing(this.bottomRowBounds)) {\n return 0;\n }\n return Math.max(this.bottomRowBounds.rowTop + this.bottomRowBounds.rowHeight - this.topRowBounds.rowTop, 0);\n }\n getCurrentPagePixelRange() {\n const pageFirstPixel = this.topRowBounds ? this.topRowBounds.rowTop : 0;\n const pageLastPixel = this.bottomRowBounds ? this.bottomRowBounds.rowTop + this.bottomRowBounds.rowHeight : 0;\n return { pageFirstPixel, pageLastPixel };\n }\n isRowPresent(rowNode) {\n if (!this.rowModel.isRowPresent(rowNode)) {\n return false;\n }\n const nodeIsInPage = rowNode.rowIndex >= this.topDisplayedRowIndex && rowNode.rowIndex <= this.bottomDisplayedRowIndex;\n return nodeIsInPage;\n }\n isEmpty() {\n return this.rowModel.isEmpty();\n }\n isRowsToRender() {\n return this.rowModel.isRowsToRender();\n }\n forEachNode(callback) {\n return this.rowModel.forEachNode(callback);\n }\n forEachNodeOnPage(callback) {\n const firstRow = this.getPageFirstRow();\n const lastRow = this.getPageLastRow();\n for (let i = firstRow; i <= lastRow; i++) {\n const node = this.getRow(i);\n if (node) {\n callback(node);\n }\n }\n }\n getType() {\n return this.rowModel.getType();\n }\n getRowBounds(index) {\n const res = this.rowModel.getRowBounds(index);\n res.rowIndex = index;\n return res;\n }\n getPageFirstRow() {\n return this.topRowBounds ? this.topRowBounds.rowIndex : -1;\n }\n getPageLastRow() {\n return this.bottomRowBounds ? this.bottomRowBounds.rowIndex : -1;\n }\n getRowCount() {\n return this.rowModel.getRowCount();\n }\n getPageForIndex(index) {\n return Math.floor(index / this.pageSize);\n }\n goToPageWithIndex(index) {\n if (!this.active) {\n return;\n }\n const pageNumber = this.getPageForIndex(index);\n this.goToPage(pageNumber);\n }\n isRowInPage(row) {\n if (!this.active) {\n return true;\n }\n const rowPage = this.getPageForIndex(row.rowIndex);\n return rowPage === this.currentPage;\n }\n isLastPageFound() {\n return this.rowModel.isLastRowIndexKnown();\n }\n getCurrentPage() {\n return this.currentPage;\n }\n goToNextPage() {\n this.goToPage(this.currentPage + 1);\n }\n goToPreviousPage() {\n this.goToPage(this.currentPage - 1);\n }\n goToFirstPage() {\n this.goToPage(0);\n }\n goToLastPage() {\n const rowCount = this.rowModel.getRowCount();\n const lastPage = Math.floor(rowCount / this.pageSize);\n this.goToPage(lastPage);\n }\n getPageSize() {\n return this.pageSize;\n }\n getTotalPages() {\n return this.totalPages;\n }\n setPageSize() {\n // show put this into super class\n this.pageSize = this.gridOptionsService.getNum('paginationPageSize');\n if (this.pageSize == null || this.pageSize < 1) {\n this.pageSize = 100;\n }\n }\n calculatePages() {\n if (this.active) {\n this.setPageSize();\n if (this.paginateChildRows) {\n this.calculatePagesAllRows();\n }\n else {\n this.calculatePagesMasterRowsOnly();\n }\n }\n else {\n this.calculatedPagesNotActive();\n }\n this.topRowBounds = this.rowModel.getRowBounds(this.topDisplayedRowIndex);\n if (this.topRowBounds) {\n this.topRowBounds.rowIndex = this.topDisplayedRowIndex;\n }\n this.bottomRowBounds = this.rowModel.getRowBounds(this.bottomDisplayedRowIndex);\n if (this.bottomRowBounds) {\n this.bottomRowBounds.rowIndex = this.bottomDisplayedRowIndex;\n }\n this.setPixelOffset(exists(this.topRowBounds) ? this.topRowBounds.rowTop : 0);\n }\n setPixelOffset(value) {\n if (this.pixelOffset === value) {\n return;\n }\n this.pixelOffset = value;\n this.eventService.dispatchEvent({ type: Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED });\n }\n setZeroRows() {\n this.masterRowCount = 0;\n this.topDisplayedRowIndex = 0;\n this.bottomDisplayedRowIndex = -1;\n this.currentPage = 0;\n this.totalPages = 0;\n }\n adjustCurrentPageIfInvalid() {\n if (this.currentPage >= this.totalPages) {\n this.currentPage = this.totalPages - 1;\n }\n if (!isFinite(this.currentPage) || isNaN(this.currentPage) || this.currentPage < 0) {\n this.currentPage = 0;\n }\n }\n calculatePagesMasterRowsOnly() {\n // const csrm = this.rowModel;\n // const rootNode = csrm.getRootNode();\n // const masterRows = rootNode.childrenAfterSort;\n this.masterRowCount = this.rowModel.getTopLevelRowCount();\n // we say <=0 (rather than =0) as viewport returns -1 when no rows\n if (this.masterRowCount <= 0) {\n this.setZeroRows();\n return;\n }\n const masterLastRowIndex = this.masterRowCount - 1;\n this.totalPages = Math.floor((masterLastRowIndex) / this.pageSize) + 1;\n this.adjustCurrentPageIfInvalid();\n const masterPageStartIndex = this.pageSize * this.currentPage;\n let masterPageEndIndex = (this.pageSize * (this.currentPage + 1)) - 1;\n if (masterPageEndIndex > masterLastRowIndex) {\n masterPageEndIndex = masterLastRowIndex;\n }\n this.topDisplayedRowIndex = this.rowModel.getTopLevelRowDisplayedIndex(masterPageStartIndex);\n // masterRows[masterPageStartIndex].rowIndex;\n if (masterPageEndIndex === masterLastRowIndex) {\n // if showing the last master row, then we want to show the very last row of the model\n this.bottomDisplayedRowIndex = this.rowModel.getRowCount() - 1;\n }\n else {\n const firstIndexNotToShow = this.rowModel.getTopLevelRowDisplayedIndex(masterPageEndIndex + 1);\n //masterRows[masterPageEndIndex + 1].rowIndex;\n // this gets the index of the last child - eg current row is open, we want to display all children,\n // the index of the last child is one less than the index of the next parent row.\n this.bottomDisplayedRowIndex = firstIndexNotToShow - 1;\n }\n }\n getMasterRowCount() {\n return this.masterRowCount;\n }\n calculatePagesAllRows() {\n this.masterRowCount = this.rowModel.getRowCount();\n if (this.masterRowCount === 0) {\n this.setZeroRows();\n return;\n }\n const maxRowIndex = this.masterRowCount - 1;\n this.totalPages = Math.floor((maxRowIndex) / this.pageSize) + 1;\n this.adjustCurrentPageIfInvalid();\n this.topDisplayedRowIndex = this.pageSize * this.currentPage;\n this.bottomDisplayedRowIndex = (this.pageSize * (this.currentPage + 1)) - 1;\n if (this.bottomDisplayedRowIndex > maxRowIndex) {\n this.bottomDisplayedRowIndex = maxRowIndex;\n }\n }\n calculatedPagesNotActive() {\n this.pageSize = this.rowModel.getRowCount();\n this.totalPages = 1;\n this.currentPage = 0;\n this.topDisplayedRowIndex = 0;\n this.bottomDisplayedRowIndex = this.rowModel.getRowCount() - 1;\n }\n};\n__decorate([\n Autowired('rowModel')\n], PaginationProxy.prototype, \"rowModel\", void 0);\n__decorate([\n PostConstruct\n], PaginationProxy.prototype, \"postConstruct\", null);\nPaginationProxy = __decorate([\n Bean('paginationProxy')\n], PaginationProxy);\nexport { PaginationProxy };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nlet StylingService = class StylingService extends BeanStub {\n processAllCellClasses(colDef, params, onApplicableClass, onNotApplicableClass) {\n this.processClassRules(colDef.cellClassRules, params, onApplicableClass, onNotApplicableClass);\n this.processStaticCellClasses(colDef, params, onApplicableClass);\n }\n processClassRules(classRules, params, onApplicableClass, onNotApplicableClass) {\n if (classRules == null) {\n return;\n }\n const classNames = Object.keys(classRules);\n const classesToApply = {};\n const classesToRemove = {};\n for (let i = 0; i < classNames.length; i++) {\n const className = classNames[i];\n const rule = classRules[className];\n let resultOfRule;\n if (typeof rule === 'string') {\n resultOfRule = this.expressionService.evaluate(rule, params);\n }\n else if (typeof rule === 'function') {\n resultOfRule = rule(params);\n }\n // in case className = 'my-class1 my-class2', we need to split into individual class names\n className.split(' ').forEach(singleClass => {\n if (singleClass == null || singleClass.trim() == '') {\n return;\n }\n resultOfRule ? classesToApply[singleClass] = true : classesToRemove[singleClass] = true;\n });\n }\n // we remove all classes first, then add all classes second,\n // in case a class appears in more than one rule, this means it will be added\n // if appears in at least one truthy rule\n if (onNotApplicableClass) {\n Object.keys(classesToRemove).forEach(onNotApplicableClass);\n }\n Object.keys(classesToApply).forEach(onApplicableClass);\n }\n getStaticCellClasses(colDef, params) {\n const { cellClass } = colDef;\n if (!cellClass) {\n return [];\n }\n let classOrClasses;\n if (typeof cellClass === 'function') {\n const cellClassFunc = cellClass;\n classOrClasses = cellClassFunc(params);\n }\n else {\n classOrClasses = cellClass;\n }\n if (typeof classOrClasses === 'string') {\n classOrClasses = [classOrClasses];\n }\n return classOrClasses || [];\n }\n processStaticCellClasses(colDef, params, onApplicableClass) {\n const classOrClasses = this.getStaticCellClasses(colDef, params);\n classOrClasses.forEach((cssClassItem) => {\n onApplicableClass(cssClassItem);\n });\n }\n};\n__decorate([\n Autowired('expressionService')\n], StylingService.prototype, \"expressionService\", void 0);\nStylingService = __decorate([\n Bean('stylingService')\n], StylingService);\nexport { StylingService };\n","import { AgCheckbox } from './agCheckbox.mjs';\nexport class AgToggleButton extends AgCheckbox {\n constructor(config) {\n super(config, 'ag-toggle-button');\n }\n setValue(value, silent) {\n super.setValue(value, silent);\n this.addOrRemoveCssClass('ag-selected', this.getValue());\n return this;\n }\n}\n","import { AgAbstractInputField } from \"./agAbstractInputField.mjs\";\nexport class AgInputTextArea extends AgAbstractInputField {\n constructor(config) {\n super(config, 'ag-text-area', null, 'textarea');\n }\n setValue(value, silent) {\n const ret = super.setValue(value, silent);\n this.eInput.value = value;\n return ret;\n }\n setCols(cols) {\n this.eInput.cols = cols;\n return this;\n }\n setRows(rows) {\n this.eInput.rows = rows;\n return this;\n }\n}\n","import { AgInputTextField } from \"./agInputTextField.mjs\";\nimport { addOrRemoveAttribute } from \"../utils/dom.mjs\";\nimport { parseDateTimeFromString, serialiseDate } from \"../utils/date.mjs\";\nimport { isBrowserSafari } from \"../utils/browser.mjs\";\nexport class AgInputDateField extends AgInputTextField {\n constructor(config) {\n super(config, 'ag-date-field', 'date');\n }\n postConstruct() {\n super.postConstruct();\n this.addManagedListener(this.eInput, 'wheel', this.onWheel.bind(this));\n // ensures that the input element is focussed when a clear button is clicked,\n // unless using safari as there is no clear button and focus does not work properly\n const usingSafari = isBrowserSafari();\n this.addManagedListener(this.eInput, 'mousedown', () => {\n if (this.isDisabled() || usingSafari) {\n return;\n }\n this.eInput.focus();\n });\n this.eInput.step = 'any';\n }\n onWheel(e) {\n // Prevent default scroll events from incrementing / decrementing the input, since its inconsistent between browsers\n if (document.activeElement === this.eInput) {\n e.preventDefault();\n }\n }\n setMin(minDate) {\n var _a;\n const min = minDate instanceof Date ? (_a = serialiseDate(minDate !== null && minDate !== void 0 ? minDate : null, false)) !== null && _a !== void 0 ? _a : undefined : minDate;\n if (this.min === min) {\n return this;\n }\n this.min = min;\n addOrRemoveAttribute(this.eInput, 'min', min);\n return this;\n }\n setMax(maxDate) {\n var _a;\n const max = maxDate instanceof Date ? (_a = serialiseDate(maxDate !== null && maxDate !== void 0 ? maxDate : null, false)) !== null && _a !== void 0 ? _a : undefined : maxDate;\n if (this.max === max) {\n return this;\n }\n this.max = max;\n addOrRemoveAttribute(this.eInput, 'max', max);\n return this;\n }\n setStep(step) {\n if (this.step === step) {\n return this;\n }\n this.step = step;\n addOrRemoveAttribute(this.eInput, 'step', step);\n return this;\n }\n getDate() {\n var _a;\n if (!this.eInput.validity.valid) {\n return undefined;\n }\n return (_a = parseDateTimeFromString(this.getValue())) !== null && _a !== void 0 ? _a : undefined;\n }\n setDate(date, silent) {\n this.setValue(serialiseDate(date !== null && date !== void 0 ? date : null, false), silent);\n }\n}\n","import { AgAbstractInputField } from \"./agAbstractInputField.mjs\";\nexport class AgInputRange extends AgAbstractInputField {\n constructor(config) {\n super(config, 'ag-range-field', 'range');\n }\n postConstruct() {\n super.postConstruct();\n const { min, max, step } = this.config;\n if (min != null) {\n this.setMinValue(min);\n }\n if (max != null) {\n this.setMaxValue(max);\n }\n this.setStep(step || 1);\n }\n addInputListeners() {\n this.addManagedListener(this.eInput, 'input', (e) => {\n const value = e.target.value;\n this.setValue(value);\n });\n }\n setMinValue(value) {\n this.min = value;\n this.eInput.setAttribute('min', value.toString());\n return this;\n }\n setMaxValue(value) {\n this.max = value;\n this.eInput.setAttribute('max', value.toString());\n return this;\n }\n setStep(value) {\n this.eInput.setAttribute('step', value.toString());\n return this;\n }\n setValue(value, silent) {\n if (this.min != null) {\n value = Math.max(parseFloat(value), this.min).toString();\n }\n if (this.max != null) {\n value = Math.min(parseFloat(value), this.max).toString();\n }\n const ret = super.setValue(value, silent);\n this.eInput.value = value;\n return ret;\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { bindCellRendererToHtmlElement } from \"../utils/dom.mjs\";\nimport { Component } from \"./component.mjs\";\nimport { escapeString } from \"../utils/string.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nimport { setAriaSelected } from \"../utils/aria.mjs\";\nexport class RichSelectRow extends Component {\n constructor(params, wrapperEl) {\n super(/* html */ `
`);\n this.params = params;\n this.wrapperEl = wrapperEl;\n }\n postConstruct() {\n this.addManagedListener(this.getGui(), 'mouseup', this.onMouseUp.bind(this));\n }\n setState(value, selected) {\n let formattedValue = '';\n if (this.params.valueFormatter) {\n formattedValue = this.params.valueFormatter(value);\n }\n const rendererSuccessful = this.populateWithRenderer(value, formattedValue);\n if (!rendererSuccessful) {\n this.populateWithoutRenderer(value, formattedValue);\n }\n this.value = value;\n }\n updateHighlighted(highlighted) {\n var _a;\n const eGui = this.getGui();\n const parentId = `ag-rich-select-row-${this.getCompId()}`;\n (_a = eGui.parentElement) === null || _a === void 0 ? void 0 : _a.setAttribute('id', parentId);\n if (highlighted) {\n const parentAriaEl = this.getParentComponent().getAriaElement();\n parentAriaEl.setAttribute('aria-activedescendant', parentId);\n this.wrapperEl.setAttribute('data-active-option', parentId);\n }\n setAriaSelected(eGui.parentElement, highlighted);\n this.addOrRemoveCssClass('ag-rich-select-row-selected', highlighted);\n }\n populateWithoutRenderer(value, valueFormatted) {\n const eDocument = this.gridOptionsService.getDocument();\n const eGui = this.getGui();\n const span = eDocument.createElement('span');\n span.style.overflow = 'hidden';\n span.style.textOverflow = 'ellipsis';\n const parsedValue = escapeString(exists(valueFormatted) ? valueFormatted : value);\n span.textContent = exists(parsedValue) ? parsedValue : ' ';\n eGui.appendChild(span);\n }\n populateWithRenderer(value, valueFormatted) {\n // bad coder here - we are not populating all values of the cellRendererParams\n let cellRendererPromise;\n let userCompDetails;\n if (this.params.cellRenderer) {\n userCompDetails = this.userComponentFactory.getCellRendererDetails(this.params, {\n value,\n valueFormatted,\n api: this.gridOptionsService.api\n });\n }\n if (userCompDetails) {\n cellRendererPromise = userCompDetails.newAgStackInstance();\n }\n if (cellRendererPromise) {\n bindCellRendererToHtmlElement(cellRendererPromise, this.getGui());\n }\n if (cellRendererPromise) {\n cellRendererPromise.then(childComponent => {\n this.addDestroyFunc(() => {\n this.getContext().destroyBean(childComponent);\n });\n });\n return true;\n }\n return false;\n }\n onMouseUp() {\n const parent = this.getParentComponent();\n const event = {\n type: Events.EVENT_FIELD_PICKER_VALUE_SELECTED,\n fromEnterKey: false,\n value: this.value\n };\n parent === null || parent === void 0 ? void 0 : parent.dispatchEvent(event);\n }\n}\n__decorate([\n Autowired('userComponentFactory')\n], RichSelectRow.prototype, \"userComponentFactory\", void 0);\n__decorate([\n PostConstruct\n], RichSelectRow.prototype, \"postConstruct\", null);\n","import { Component } from \"./component.mjs\";\nimport { isNodeOrElement, clearElement } from \"../utils/dom.mjs\";\nimport { TabGuardCtrl, TabGuardClassNames } from \"./tabGuardCtrl.mjs\";\nimport { setAriaRole } from \"../utils/aria.mjs\";\nexport class TabGuardComp extends Component {\n initialiseTabGuard(params) {\n this.eTopGuard = this.createTabGuard('top');\n this.eBottomGuard = this.createTabGuard('bottom');\n this.eFocusableElement = this.getFocusableElement();\n const tabGuards = [this.eTopGuard, this.eBottomGuard];\n const compProxy = {\n setTabIndex: tabIndex => {\n tabGuards.forEach(tabGuard => tabIndex != null ? tabGuard.setAttribute('tabindex', tabIndex) : tabGuard.removeAttribute('tabindex'));\n }\n };\n this.addTabGuards(this.eTopGuard, this.eBottomGuard);\n this.tabGuardCtrl = this.createManagedBean(new TabGuardCtrl({\n comp: compProxy,\n eTopGuard: this.eTopGuard,\n eBottomGuard: this.eBottomGuard,\n eFocusableElement: this.eFocusableElement,\n onFocusIn: params.onFocusIn,\n onFocusOut: params.onFocusOut,\n focusInnerElement: params.focusInnerElement,\n handleKeyDown: params.handleKeyDown,\n onTabKeyDown: params.onTabKeyDown,\n shouldStopEventPropagation: params.shouldStopEventPropagation\n }));\n }\n createTabGuard(side) {\n const tabGuard = document.createElement('div');\n const cls = side === 'top' ? TabGuardClassNames.TAB_GUARD_TOP : TabGuardClassNames.TAB_GUARD_BOTTOM;\n tabGuard.classList.add(TabGuardClassNames.TAB_GUARD, cls);\n setAriaRole(tabGuard, 'presentation');\n return tabGuard;\n }\n addTabGuards(topTabGuard, bottomTabGuard) {\n this.eFocusableElement.insertAdjacentElement('afterbegin', topTabGuard);\n this.eFocusableElement.insertAdjacentElement('beforeend', bottomTabGuard);\n }\n removeAllChildrenExceptTabGuards() {\n const tabGuards = [this.eTopGuard, this.eBottomGuard];\n clearElement(this.getFocusableElement());\n this.addTabGuards(...tabGuards);\n }\n forceFocusOutOfContainer(up = false) {\n this.tabGuardCtrl.forceFocusOutOfContainer(up);\n }\n appendChild(newChild, container) {\n if (!isNodeOrElement(newChild)) {\n newChild = newChild.getGui();\n }\n const { eBottomGuard: bottomTabGuard } = this;\n if (bottomTabGuard) {\n bottomTabGuard.insertAdjacentElement('beforebegin', newChild);\n }\n else {\n super.appendChild(newChild, container);\n }\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from '../context/context.mjs';\nimport { RefSelector } from './componentAnnotations.mjs';\nimport { getAriaPosInSet, setAriaSetSize, setAriaPosInSet, setAriaSelected, setAriaChecked, setAriaRole, setAriaLabel } from '../utils/aria.mjs';\nimport { KeyCode } from '../constants/keyCode.mjs';\nimport { waitUntil } from '../utils/function.mjs';\nimport { TabGuardComp } from './tabGuardComp.mjs';\nimport { Events } from '../eventKeys.mjs';\nimport { stopPropagationForAgGrid } from '../utils/event.mjs';\nexport class VirtualList extends TabGuardComp {\n constructor(params) {\n super(VirtualList.getTemplate((params === null || params === void 0 ? void 0 : params.cssIdentifier) || 'default'));\n this.renderedRows = new Map();\n this.rowHeight = 20;\n const { cssIdentifier = 'default', ariaRole = 'listbox', listName } = params || {};\n this.cssIdentifier = cssIdentifier;\n this.ariaRole = ariaRole;\n this.listName = listName;\n }\n postConstruct() {\n this.addScrollListener();\n this.rowHeight = this.getItemHeight();\n this.addResizeObserver();\n this.initialiseTabGuard({\n onFocusIn: (e) => this.onFocusIn(e),\n onFocusOut: (e) => this.onFocusOut(e),\n focusInnerElement: (fromBottom) => this.focusInnerElement(fromBottom),\n onTabKeyDown: e => this.onTabKeyDown(e),\n handleKeyDown: e => this.handleKeyDown(e)\n });\n this.setAriaProperties();\n this.addManagedListener(this.eventService, Events.EVENT_GRID_STYLES_CHANGED, this.onGridStylesChanged.bind(this));\n }\n onGridStylesChanged() {\n this.rowHeight = this.getItemHeight();\n this.refresh();\n }\n setAriaProperties() {\n const translate = this.localeService.getLocaleTextFunc();\n const listName = translate('ariaDefaultListName', this.listName || 'List');\n const ariaEl = this.eContainer;\n setAriaRole(ariaEl, this.ariaRole);\n setAriaLabel(ariaEl, listName);\n }\n addResizeObserver() {\n const listener = () => this.drawVirtualRows();\n const destroyObserver = this.resizeObserverService.observeResize(this.getGui(), listener);\n this.addDestroyFunc(destroyObserver);\n }\n focusInnerElement(fromBottom) {\n this.focusRow(fromBottom ? this.model.getRowCount() - 1 : 0);\n }\n onFocusIn(e) {\n const target = e.target;\n if (target.classList.contains('ag-virtual-list-item')) {\n this.lastFocusedRowIndex = getAriaPosInSet(target) - 1;\n }\n return false;\n }\n onFocusOut(e) {\n if (!this.getFocusableElement().contains(e.relatedTarget)) {\n this.lastFocusedRowIndex = null;\n }\n return false;\n }\n handleKeyDown(e) {\n switch (e.key) {\n case KeyCode.UP:\n case KeyCode.DOWN:\n if (this.navigate(e.key === KeyCode.UP)) {\n e.preventDefault();\n }\n break;\n }\n }\n onTabKeyDown(e) {\n if (this.navigate(e.shiftKey)) {\n e.preventDefault();\n }\n else {\n stopPropagationForAgGrid(e);\n this.forceFocusOutOfContainer(e.shiftKey);\n }\n }\n navigate(up) {\n if (this.lastFocusedRowIndex == null) {\n return false;\n }\n const nextRow = this.lastFocusedRowIndex + (up ? -1 : 1);\n if (nextRow < 0 || nextRow >= this.model.getRowCount()) {\n return false;\n }\n this.focusRow(nextRow);\n return true;\n }\n getLastFocusedRow() {\n return this.lastFocusedRowIndex;\n }\n focusRow(rowNumber) {\n this.ensureIndexVisible(rowNumber);\n window.setTimeout(() => {\n if (!this.isAlive()) {\n return;\n }\n const renderedRow = this.renderedRows.get(rowNumber);\n if (renderedRow) {\n renderedRow.eDiv.focus();\n }\n }, 10);\n }\n getComponentAt(rowIndex) {\n const comp = this.renderedRows.get(rowIndex);\n return comp && comp.rowComponent;\n }\n forEachRenderedRow(func) {\n this.renderedRows.forEach((value, key) => func(value.rowComponent, key));\n }\n static getTemplate(cssIdentifier) {\n return ( /* html */`
\n
\n
`);\n }\n getItemHeight() {\n return this.environment.getListItemHeight();\n }\n ensureIndexVisible(index) {\n const lastRow = this.model.getRowCount();\n if (typeof index !== 'number' || index < 0 || index >= lastRow) {\n console.warn('AG Grid: invalid row index for ensureIndexVisible: ' + index);\n return;\n }\n const rowTopPixel = index * this.rowHeight;\n const rowBottomPixel = rowTopPixel + this.rowHeight;\n const eGui = this.getGui();\n const viewportTopPixel = eGui.scrollTop;\n const viewportHeight = eGui.offsetHeight;\n const viewportBottomPixel = viewportTopPixel + viewportHeight;\n const viewportScrolledPastRow = viewportTopPixel > rowTopPixel;\n const viewportScrolledBeforeRow = viewportBottomPixel < rowBottomPixel;\n if (viewportScrolledPastRow) {\n // if row is before, scroll up with row at top\n eGui.scrollTop = rowTopPixel;\n }\n else if (viewportScrolledBeforeRow) {\n // if row is below, scroll down with row at bottom\n const newScrollPosition = rowBottomPixel - viewportHeight;\n eGui.scrollTop = newScrollPosition;\n }\n }\n setComponentCreator(componentCreator) {\n this.componentCreator = componentCreator;\n }\n setComponentUpdater(componentUpdater) {\n this.componentUpdater = componentUpdater;\n }\n getRowHeight() {\n return this.rowHeight;\n }\n getScrollTop() {\n return this.getGui().scrollTop;\n }\n setRowHeight(rowHeight) {\n this.rowHeight = rowHeight;\n this.refresh();\n }\n refresh(softRefresh) {\n if (this.model == null || !this.isAlive()) {\n return;\n }\n const rowCount = this.model.getRowCount();\n this.eContainer.style.height = `${rowCount * this.rowHeight}px`;\n // ensure height is applied before attempting to redraw rows\n waitUntil(() => this.eContainer.clientHeight >= rowCount * this.rowHeight, () => {\n if (!this.isAlive()) {\n return;\n }\n if (this.canSoftRefresh(softRefresh)) {\n this.drawVirtualRows(true);\n }\n else {\n this.clearVirtualRows();\n this.drawVirtualRows();\n }\n });\n }\n canSoftRefresh(softRefresh) {\n return !!(softRefresh && this.renderedRows.size && typeof this.model.areRowsEqual === 'function' && this.componentUpdater);\n }\n clearVirtualRows() {\n this.renderedRows.forEach((_, rowIndex) => this.removeRow(rowIndex));\n }\n drawVirtualRows(softRefresh) {\n if (!this.isAlive() || !this.model) {\n return;\n }\n const gui = this.getGui();\n const topPixel = gui.scrollTop;\n const bottomPixel = topPixel + gui.offsetHeight;\n const firstRow = Math.floor(topPixel / this.rowHeight);\n const lastRow = Math.floor(bottomPixel / this.rowHeight);\n this.ensureRowsRendered(firstRow, lastRow, softRefresh);\n }\n ensureRowsRendered(start, finish, softRefresh) {\n // remove any rows that are no longer required\n this.renderedRows.forEach((_, rowIndex) => {\n if ((rowIndex < start || rowIndex > finish) && rowIndex !== this.lastFocusedRowIndex) {\n this.removeRow(rowIndex);\n }\n });\n if (softRefresh) {\n // refresh any existing rows\n this.refreshRows();\n }\n // insert any required new rows\n for (let rowIndex = start; rowIndex <= finish; rowIndex++) {\n if (this.renderedRows.has(rowIndex)) {\n continue;\n }\n // check this row actually exists (in case overflow buffer window exceeds real data)\n if (rowIndex < this.model.getRowCount()) {\n this.insertRow(rowIndex);\n }\n }\n }\n insertRow(rowIndex) {\n const value = this.model.getRow(rowIndex);\n const eDiv = document.createElement('div');\n eDiv.classList.add('ag-virtual-list-item', `ag-${this.cssIdentifier}-virtual-list-item`);\n setAriaRole(eDiv, this.ariaRole === 'tree' ? 'treeitem' : 'option');\n setAriaSetSize(eDiv, this.model.getRowCount());\n setAriaPosInSet(eDiv, rowIndex + 1);\n eDiv.setAttribute('tabindex', '-1');\n if (typeof this.model.isRowSelected === 'function') {\n const isSelected = this.model.isRowSelected(rowIndex);\n setAriaSelected(eDiv, !!isSelected);\n setAriaChecked(eDiv, isSelected);\n }\n eDiv.style.height = `${this.rowHeight}px`;\n eDiv.style.top = `${this.rowHeight * rowIndex}px`;\n const rowComponent = this.componentCreator(value, eDiv);\n rowComponent.addGuiEventListener('focusin', () => this.lastFocusedRowIndex = rowIndex);\n eDiv.appendChild(rowComponent.getGui());\n // keep the DOM order consistent with the order of the rows\n if (this.renderedRows.has(rowIndex - 1)) {\n this.renderedRows.get(rowIndex - 1).eDiv.insertAdjacentElement('afterend', eDiv);\n }\n else if (this.renderedRows.has(rowIndex + 1)) {\n this.renderedRows.get(rowIndex + 1).eDiv.insertAdjacentElement('beforebegin', eDiv);\n }\n else {\n this.eContainer.appendChild(eDiv);\n }\n this.renderedRows.set(rowIndex, { rowComponent, eDiv, value });\n }\n removeRow(rowIndex) {\n const component = this.renderedRows.get(rowIndex);\n this.eContainer.removeChild(component.eDiv);\n this.destroyBean(component.rowComponent);\n this.renderedRows.delete(rowIndex);\n }\n refreshRows() {\n const rowCount = this.model.getRowCount();\n this.renderedRows.forEach((row, rowIndex) => {\n var _a, _b;\n if (rowIndex >= rowCount) {\n this.removeRow(rowIndex);\n }\n else {\n const newValue = this.model.getRow(rowIndex);\n if ((_b = (_a = this.model).areRowsEqual) === null || _b === void 0 ? void 0 : _b.call(_a, row.value, newValue)) {\n this.componentUpdater(newValue, row.rowComponent);\n }\n else {\n // to be replaced later\n this.removeRow(rowIndex);\n }\n }\n });\n }\n addScrollListener() {\n this.addGuiEventListener('scroll', () => this.drawVirtualRows(), { passive: true });\n }\n setModel(model) {\n this.model = model;\n }\n getAriaElement() {\n return this.eContainer;\n }\n destroy() {\n if (!this.isAlive()) {\n return;\n }\n this.clearVirtualRows();\n super.destroy();\n }\n}\n__decorate([\n Autowired('resizeObserverService')\n], VirtualList.prototype, \"resizeObserverService\", void 0);\n__decorate([\n RefSelector('eContainer')\n], VirtualList.prototype, \"eContainer\", void 0);\n__decorate([\n PostConstruct\n], VirtualList.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { KeyCode } from \"../constants/keyCode.mjs\";\nimport { Autowired } from \"../context/context.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { setAriaControls } from \"../utils/aria.mjs\";\nimport { bindCellRendererToHtmlElement, clearElement } from \"../utils/dom.mjs\";\nimport { debounce } from \"../utils/function.mjs\";\nimport { fuzzySuggestions } from \"../utils/fuzzyMatch.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nimport { isEventFromPrintableCharacter } from \"../utils/keyboard.mjs\";\nimport { AgPickerField } from \"./agPickerField.mjs\";\nimport { RichSelectRow } from \"./agRichSelectRow.mjs\";\nimport { VirtualList } from \"./virtualList.mjs\";\nexport class AgRichSelect extends AgPickerField {\n constructor(config) {\n super(Object.assign({ pickerAriaLabelKey: 'ariaLabelRichSelectField', pickerAriaLabelValue: 'Rich Select Field', pickerType: 'ag-list' }, config), 'ag-rich-select', 'smallDown', 'combobox');\n this.searchString = '';\n this.highlightedItem = -1;\n const { cellRowHeight, value, valueList, searchDebounceDelay } = config || {};\n if (cellRowHeight) {\n this.cellRowHeight = cellRowHeight;\n }\n if (value != null) {\n this.value = value;\n }\n if (valueList != null) {\n this.setValueList(valueList);\n }\n if (searchDebounceDelay != null) {\n this.searchDebounceDelay = searchDebounceDelay;\n }\n }\n postConstruct() {\n var _a, _b;\n super.postConstruct();\n this.createListComponent();\n this.eWrapper.tabIndex = (_a = this.gridOptionsService.getNum('tabIndex')) !== null && _a !== void 0 ? _a : 0;\n this.eWrapper.classList.add('ag-rich-select-value');\n const debounceDelay = (_b = this.searchDebounceDelay) !== null && _b !== void 0 ? _b : 300;\n this.clearSearchString = debounce(this.clearSearchString, debounceDelay);\n this.renderSelectedValue();\n }\n createListComponent() {\n this.listComponent = this.createManagedBean(new VirtualList({ cssIdentifier: 'rich-select' }));\n this.listComponent.setComponentCreator(this.createRowComponent.bind(this));\n this.listComponent.setParentComponent(this);\n this.addManagedListener(this.listComponent, Events.EVENT_FIELD_PICKER_VALUE_SELECTED, (e) => {\n this.onListValueSelected(e.value, e.fromEnterKey);\n });\n if (this.cellRowHeight) {\n this.listComponent.setRowHeight(this.cellRowHeight);\n }\n const eListGui = this.listComponent.getGui();\n const eListAriaEl = this.listComponent.getAriaElement();\n this.addManagedListener(eListGui, 'mousemove', this.onPickerMouseMove.bind(this));\n this.addManagedListener(eListGui, 'mousedown', e => e.preventDefault());\n eListGui.classList.add('ag-rich-select-list');\n const listId = `ag-rich-select-list-${this.listComponent.getCompId()}`;\n eListAriaEl.setAttribute('id', listId);\n setAriaControls(this.eWrapper, eListAriaEl);\n }\n renderSelectedValue() {\n const { value, eDisplayField, config } = this;\n const valueFormatted = this.config.valueFormatter ? this.config.valueFormatter(value) : value;\n let userCompDetails;\n if (config.cellRenderer) {\n userCompDetails = this.userComponentFactory.getCellRendererDetails(this.config, {\n value,\n valueFormatted,\n api: this.gridOptionsService.api\n });\n }\n let userCompDetailsPromise;\n if (userCompDetails) {\n userCompDetailsPromise = userCompDetails.newAgStackInstance();\n }\n if (userCompDetailsPromise) {\n clearElement(eDisplayField);\n bindCellRendererToHtmlElement(userCompDetailsPromise, eDisplayField);\n userCompDetailsPromise.then(renderer => {\n this.addDestroyFunc(() => this.getContext().destroyBean(renderer));\n });\n }\n else {\n if (exists(this.value)) {\n eDisplayField.innerText = valueFormatted;\n }\n else {\n clearElement(eDisplayField);\n }\n }\n }\n setValueList(valueList) {\n this.values = valueList;\n this.highlightSelectedValue();\n }\n getCurrentValueIndex() {\n const { values, value } = this;\n if (value == null) {\n return -1;\n }\n for (let i = 0; i < values.length; i++) {\n if (values[i] === value) {\n return i;\n }\n }\n return -1;\n }\n highlightSelectedValue(index) {\n if (index == null) {\n index = this.getCurrentValueIndex();\n }\n if (index === -1) {\n return;\n }\n this.highlightedItem = index;\n if (this.listComponent) {\n this.listComponent.forEachRenderedRow((cmp, idx) => {\n cmp.updateHighlighted(this.highlightedItem === idx);\n });\n }\n }\n setRowHeight(height) {\n if (height !== this.cellRowHeight) {\n this.cellRowHeight = height;\n }\n if (this.listComponent) {\n this.listComponent.setRowHeight(height);\n }\n }\n createPickerComponent() {\n const { values } = this;\n this.listComponent.setModel({\n getRowCount: () => values.length,\n getRow: (index) => values[index]\n });\n // do not create the picker every time to save state\n return this.listComponent;\n }\n showPicker() {\n var _a, _b, _c;\n super.showPicker();\n const currentValueIndex = this.getCurrentValueIndex();\n if (currentValueIndex !== -1) {\n // make sure the virtual list has been sized correctly\n (_a = this.listComponent) === null || _a === void 0 ? void 0 : _a.refresh();\n (_b = this.listComponent) === null || _b === void 0 ? void 0 : _b.ensureIndexVisible(currentValueIndex);\n this.highlightSelectedValue(currentValueIndex);\n }\n else {\n (_c = this.listComponent) === null || _c === void 0 ? void 0 : _c.refresh();\n }\n }\n beforeHidePicker() {\n this.highlightedItem = -1;\n super.beforeHidePicker();\n }\n searchText(searchKey) {\n if (typeof searchKey !== 'string') {\n let { key } = searchKey;\n if (key === KeyCode.BACKSPACE) {\n this.searchString = this.searchString.slice(0, -1);\n key = '';\n }\n else if (!isEventFromPrintableCharacter(searchKey)) {\n return;\n }\n searchKey.preventDefault();\n this.searchText(key);\n return;\n }\n this.searchString += searchKey;\n this.runSearch();\n this.clearSearchString();\n }\n runSearch() {\n const values = this.values;\n let searchStrings;\n const { valueFormatter = (value => value), searchStringCreator } = this.config;\n if (typeof values[0] === 'number' || typeof values[0] === 'string') {\n searchStrings = values.map(v => valueFormatter(v));\n }\n else if (typeof values[0] === 'object' && searchStringCreator) {\n searchStrings = searchStringCreator(values);\n }\n if (!searchStrings) {\n return;\n }\n const topSuggestion = fuzzySuggestions(this.searchString, searchStrings, true)[0];\n if (!topSuggestion) {\n return;\n }\n const topSuggestionIndex = searchStrings.indexOf(topSuggestion);\n this.selectListItem(topSuggestionIndex);\n }\n clearSearchString() {\n this.searchString = '';\n }\n selectListItem(index) {\n if (!this.isPickerDisplayed || !this.listComponent || index < 0 || index >= this.values.length) {\n return;\n }\n this.listComponent.ensureIndexVisible(index);\n this.highlightSelectedValue(index);\n }\n setValue(value, silent, fromPicker) {\n const index = this.values.indexOf(value);\n if (index === -1) {\n return this;\n }\n this.value = value;\n if (!fromPicker) {\n this.selectListItem(index);\n }\n this.renderSelectedValue();\n return super.setValue(value, silent);\n }\n createRowComponent(value) {\n const row = new RichSelectRow(this.config, this.eWrapper);\n row.setParentComponent(this.listComponent);\n this.getContext().createBean(row);\n row.setState(value, value === this.value);\n return row;\n }\n getRowForMouseEvent(e) {\n const { listComponent } = this;\n if (!listComponent) {\n return -1;\n }\n const eGui = listComponent === null || listComponent === void 0 ? void 0 : listComponent.getGui();\n const rect = eGui.getBoundingClientRect();\n const scrollTop = listComponent.getScrollTop();\n const mouseY = e.clientY - rect.top + scrollTop;\n return Math.floor(mouseY / listComponent.getRowHeight());\n }\n onPickerMouseMove(e) {\n if (!this.listComponent) {\n return;\n }\n const row = this.getRowForMouseEvent(e);\n if (row !== -1) {\n this.selectListItem(row);\n }\n }\n onNavigationKeyDown(event, key) {\n // if we don't preventDefault the page body and/or grid scroll will move.\n event.preventDefault();\n const isDown = key === KeyCode.DOWN;\n if (!this.isPickerDisplayed && isDown) {\n this.showPicker();\n return;\n }\n const oldIndex = this.highlightedItem;\n const diff = isDown ? 1 : -1;\n const newIndex = oldIndex === -1 ? 0 : oldIndex + diff;\n this.selectListItem(newIndex);\n }\n onEnterKeyDown(e) {\n if (!this.isPickerDisplayed) {\n return;\n }\n e.preventDefault();\n this.onListValueSelected(this.values[this.highlightedItem], true);\n }\n onListValueSelected(value, fromEnterKey) {\n this.setValue(value, false, true);\n this.dispatchPickerEvent(value, fromEnterKey);\n this.hidePicker();\n }\n dispatchPickerEvent(value, fromEnterKey) {\n const event = {\n type: Events.EVENT_FIELD_PICKER_VALUE_SELECTED,\n fromEnterKey,\n value\n };\n this.dispatchEvent(event);\n }\n onKeyDown(event) {\n const key = event.key;\n switch (key) {\n case KeyCode.LEFT:\n case KeyCode.RIGHT:\n event.preventDefault();\n break;\n case KeyCode.DOWN:\n case KeyCode.UP:\n this.onNavigationKeyDown(event, key);\n break;\n case KeyCode.ESCAPE:\n if (this.isPickerDisplayed) {\n this.hidePicker();\n }\n break;\n case KeyCode.ENTER:\n this.onEnterKeyDown(event);\n break;\n default:\n this.searchText(event);\n }\n }\n}\n__decorate([\n Autowired('userComponentFactory')\n], AgRichSelect.prototype, \"userComponentFactory\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { RefSelector } from \"./componentAnnotations.mjs\";\nimport { AgAbstractLabel } from \"./agAbstractLabel.mjs\";\nimport { PostConstruct } from \"../context/context.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nexport class AgSlider extends AgAbstractLabel {\n constructor(config) {\n super(config, AgSlider.TEMPLATE);\n this.labelAlignment = 'top';\n }\n init() {\n this.eSlider.addCssClass('ag-slider-field');\n }\n onValueChange(callbackFn) {\n const eventChanged = Events.EVENT_FIELD_VALUE_CHANGED;\n this.addManagedListener(this.eText, eventChanged, () => {\n const textValue = parseFloat(this.eText.getValue());\n this.eSlider.setValue(textValue.toString(), true);\n callbackFn(textValue || 0);\n });\n this.addManagedListener(this.eSlider, eventChanged, () => {\n const sliderValue = this.eSlider.getValue();\n this.eText.setValue(sliderValue, true);\n callbackFn(parseFloat(sliderValue));\n });\n return this;\n }\n setSliderWidth(width) {\n this.eSlider.setWidth(width);\n return this;\n }\n setTextFieldWidth(width) {\n this.eText.setWidth(width);\n return this;\n }\n setMinValue(minValue) {\n this.eSlider.setMinValue(minValue);\n this.eText.setMin(minValue);\n return this;\n }\n setMaxValue(maxValue) {\n this.eSlider.setMaxValue(maxValue);\n this.eText.setMax(maxValue);\n return this;\n }\n getValue() {\n return this.eText.getValue();\n }\n setValue(value) {\n if (this.getValue() === value) {\n return this;\n }\n this.eText.setValue(value, true);\n this.eSlider.setValue(value, true);\n this.dispatchEvent({ type: Events.EVENT_FIELD_VALUE_CHANGED });\n return this;\n }\n setStep(step) {\n this.eSlider.setStep(step);\n this.eText.setStep(step);\n return this;\n }\n}\nAgSlider.TEMPLATE = `
\n \n
\n \n \n
\n
`;\n__decorate([\n RefSelector('eLabel')\n], AgSlider.prototype, \"eLabel\", void 0);\n__decorate([\n RefSelector('eSlider')\n], AgSlider.prototype, \"eSlider\", void 0);\n__decorate([\n RefSelector('eText')\n], AgSlider.prototype, \"eText\", void 0);\n__decorate([\n PostConstruct\n], AgSlider.prototype, \"init\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from './component.mjs';\nimport { RefSelector } from './componentAnnotations.mjs';\nimport { PostConstruct } from '../context/context.mjs';\nimport { createIcon } from '../utils/icon.mjs';\nimport { setDisplayed } from '../utils/dom.mjs';\nimport { KeyCode } from '../constants/keyCode.mjs';\nimport { setAriaExpanded } from '../utils/aria.mjs';\nexport class AgGroupComponent extends Component {\n constructor(params = {}) {\n super(AgGroupComponent.getTemplate(params));\n this.suppressEnabledCheckbox = true;\n this.suppressOpenCloseIcons = false;\n const { title, enabled, items, suppressEnabledCheckbox, suppressOpenCloseIcons } = params;\n this.title = title;\n this.cssIdentifier = params.cssIdentifier || 'default';\n this.enabled = enabled != null ? enabled : true;\n this.items = items || [];\n this.alignItems = params.alignItems || 'center';\n if (suppressEnabledCheckbox != null) {\n this.suppressEnabledCheckbox = suppressEnabledCheckbox;\n }\n if (suppressOpenCloseIcons != null) {\n this.suppressOpenCloseIcons = suppressOpenCloseIcons;\n }\n }\n static getTemplate(params) {\n const cssIdentifier = params.cssIdentifier || 'default';\n const direction = params.direction || 'vertical';\n return /* html */ `
\n
\n \n \n \n
\n
\n \n
\n
\n
`;\n }\n postConstruct() {\n if (this.items.length) {\n const initialItems = this.items;\n this.items = [];\n this.addItems(initialItems);\n }\n const localeTextFunc = this.localeService.getLocaleTextFunc();\n this.cbGroupEnabled.setLabel(localeTextFunc('enabled', 'Enabled'));\n if (this.title) {\n this.setTitle(this.title);\n }\n if (this.enabled) {\n this.setEnabled(this.enabled);\n }\n this.setAlignItems(this.alignItems);\n this.hideEnabledCheckbox(this.suppressEnabledCheckbox);\n this.hideOpenCloseIcons(this.suppressOpenCloseIcons);\n this.setupExpandContract();\n this.refreshAriaStatus();\n this.refreshChildDisplay();\n }\n setupExpandContract() {\n this.eGroupClosedIcon.appendChild(createIcon('columnSelectClosed', this.gridOptionsService, null));\n this.eGroupOpenedIcon.appendChild(createIcon('columnSelectOpen', this.gridOptionsService, null));\n this.addManagedListener(this.eTitleBar, 'click', () => this.toggleGroupExpand());\n this.addManagedListener(this.eTitleBar, 'keydown', (e) => {\n switch (e.key) {\n case KeyCode.ENTER:\n case KeyCode.SPACE:\n e.preventDefault();\n this.toggleGroupExpand();\n break;\n case KeyCode.RIGHT:\n case KeyCode.LEFT:\n e.preventDefault();\n this.toggleGroupExpand(e.key === KeyCode.RIGHT);\n break;\n }\n });\n }\n refreshAriaStatus() {\n if (!this.suppressOpenCloseIcons) {\n setAriaExpanded(this.eTitleBar, this.expanded);\n }\n }\n refreshChildDisplay() {\n const showIcon = !this.suppressOpenCloseIcons;\n setDisplayed(this.eToolbar, this.expanded && !this.suppressEnabledCheckbox);\n setDisplayed(this.eGroupOpenedIcon, showIcon && this.expanded);\n setDisplayed(this.eGroupClosedIcon, showIcon && !this.expanded);\n }\n isExpanded() {\n return this.expanded;\n }\n setAlignItems(alignment) {\n if (this.alignItems !== alignment) {\n this.removeCssClass(`ag-group-item-alignment-${this.alignItems}`);\n }\n this.alignItems = alignment;\n const newCls = `ag-group-item-alignment-${this.alignItems}`;\n this.addCssClass(newCls);\n return this;\n }\n toggleGroupExpand(expanded) {\n if (this.suppressOpenCloseIcons) {\n this.expanded = true;\n this.refreshChildDisplay();\n setDisplayed(this.eContainer, true);\n return this;\n }\n expanded = expanded != null ? expanded : !this.expanded;\n if (this.expanded === expanded) {\n return this;\n }\n this.expanded = expanded;\n this.refreshAriaStatus();\n this.refreshChildDisplay();\n setDisplayed(this.eContainer, expanded);\n this.dispatchEvent({ type: this.expanded ? AgGroupComponent.EVENT_EXPANDED : AgGroupComponent.EVENT_COLLAPSED });\n return this;\n }\n addItems(items) {\n items.forEach(item => this.addItem(item));\n }\n addItem(item) {\n const container = this.eContainer;\n const el = item instanceof Component ? item.getGui() : item;\n el.classList.add('ag-group-item', `ag-${this.cssIdentifier}-group-item`);\n container.appendChild(el);\n this.items.push(el);\n }\n hideItem(hide, index) {\n const itemToHide = this.items[index];\n setDisplayed(itemToHide, !hide);\n }\n setTitle(title) {\n this.eTitle.innerText = title;\n return this;\n }\n addCssClassToTitleBar(cssClass) {\n this.eTitleBar.classList.add(cssClass);\n }\n setEnabled(enabled, skipToggle) {\n this.enabled = enabled;\n this.refreshDisabledStyles();\n this.toggleGroupExpand(enabled);\n if (!skipToggle) {\n this.cbGroupEnabled.setValue(enabled);\n }\n return this;\n }\n isEnabled() {\n return this.enabled;\n }\n onEnableChange(callbackFn) {\n this.cbGroupEnabled.onValueChange((newSelection) => {\n this.setEnabled(newSelection, true);\n callbackFn(newSelection);\n });\n return this;\n }\n hideEnabledCheckbox(hide) {\n this.suppressEnabledCheckbox = hide;\n this.refreshChildDisplay();\n this.refreshDisabledStyles();\n return this;\n }\n hideOpenCloseIcons(hide) {\n this.suppressOpenCloseIcons = hide;\n if (hide) {\n this.toggleGroupExpand(true);\n }\n return this;\n }\n refreshDisabledStyles() {\n this.addOrRemoveCssClass('ag-disabled', !this.enabled);\n if (this.suppressEnabledCheckbox && !this.enabled) {\n this.eTitleBar.classList.add('ag-disabled-group-title-bar');\n this.eTitleBar.removeAttribute('tabindex');\n }\n else {\n this.eTitleBar.classList.remove('ag-disabled-group-title-bar');\n this.eTitleBar.setAttribute('tabindex', '0');\n }\n this.eContainer.classList.toggle('ag-disabled-group-container', !this.enabled);\n }\n}\nAgGroupComponent.EVENT_EXPANDED = 'expanded';\nAgGroupComponent.EVENT_COLLAPSED = 'collapsed';\n__decorate([\n RefSelector('eTitleBar')\n], AgGroupComponent.prototype, \"eTitleBar\", void 0);\n__decorate([\n RefSelector('eGroupOpenedIcon')\n], AgGroupComponent.prototype, \"eGroupOpenedIcon\", void 0);\n__decorate([\n RefSelector('eGroupClosedIcon')\n], AgGroupComponent.prototype, \"eGroupClosedIcon\", void 0);\n__decorate([\n RefSelector('eToolbar')\n], AgGroupComponent.prototype, \"eToolbar\", void 0);\n__decorate([\n RefSelector('cbGroupEnabled')\n], AgGroupComponent.prototype, \"cbGroupEnabled\", void 0);\n__decorate([\n RefSelector('eTitle')\n], AgGroupComponent.prototype, \"eTitle\", void 0);\n__decorate([\n RefSelector('eContainer')\n], AgGroupComponent.prototype, \"eContainer\", void 0);\n__decorate([\n PostConstruct\n], AgGroupComponent.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { AgMenuItemComponent } from \"./agMenuItemComponent.mjs\";\nimport { TabGuardComp } from \"./tabGuardComp.mjs\";\nimport { KeyCode } from \"../constants/keyCode.mjs\";\nimport { loadTemplate } from \"../utils/dom.mjs\";\nimport { last } from \"../utils/array.mjs\";\nimport { setAriaLevel } from \"../utils/aria.mjs\";\nexport class AgMenuList extends TabGuardComp {\n constructor(level = 1) {\n super(/* html */ `
`);\n this.level = level;\n this.menuItems = [];\n }\n postConstruct() {\n this.initialiseTabGuard({\n onTabKeyDown: e => this.onTabKeyDown(e),\n handleKeyDown: e => this.handleKeyDown(e)\n });\n }\n onTabKeyDown(e) {\n const parent = this.getParentComponent();\n const parentGui = parent && parent.getGui();\n const isManaged = parentGui && parentGui.classList.contains('ag-focus-managed');\n if (!isManaged) {\n e.preventDefault();\n }\n if (e.shiftKey) {\n this.closeIfIsChild(e);\n }\n }\n handleKeyDown(e) {\n switch (e.key) {\n case KeyCode.UP:\n case KeyCode.RIGHT:\n case KeyCode.DOWN:\n case KeyCode.LEFT:\n e.preventDefault();\n this.handleNavKey(e.key);\n break;\n case KeyCode.ESCAPE:\n const topMenu = this.findTopMenu();\n if (topMenu) {\n this.focusService.focusInto(topMenu.getGui());\n }\n break;\n }\n }\n clearActiveItem() {\n if (this.activeMenuItem) {\n this.activeMenuItem.deactivate();\n this.activeMenuItem = null;\n }\n }\n addMenuItems(menuItems) {\n if (menuItems == null) {\n return;\n }\n menuItems.forEach(menuItemOrString => {\n if (menuItemOrString === 'separator') {\n this.addSeparator();\n }\n else if (typeof menuItemOrString === 'string') {\n console.warn(`AG Grid: unrecognised menu item ${menuItemOrString}`);\n }\n else {\n this.addItem(menuItemOrString);\n }\n });\n }\n addItem(menuItemDef) {\n const menuItem = this.createManagedBean(new AgMenuItemComponent(Object.assign(Object.assign({}, menuItemDef), { isAnotherSubMenuOpen: () => this.menuItems.some(m => m.isSubMenuOpen()) })));\n menuItem.setParentComponent(this);\n setAriaLevel(menuItem.getGui(), this.level);\n this.menuItems.push(menuItem);\n this.appendChild(menuItem.getGui());\n this.addManagedListener(menuItem, AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED, (event) => {\n this.dispatchEvent(event);\n });\n this.addManagedListener(menuItem, AgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED, (event) => {\n if (this.activeMenuItem && this.activeMenuItem !== event.menuItem) {\n this.activeMenuItem.deactivate();\n }\n this.activeMenuItem = event.menuItem;\n });\n }\n activateFirstItem() {\n const item = this.menuItems.filter(currentItem => !currentItem.isDisabled())[0];\n if (!item) {\n return;\n }\n item.activate();\n }\n addSeparator() {\n const separatorHtml = /* html */ `\n
\n
\n
\n
\n
\n
`;\n this.appendChild(loadTemplate(separatorHtml));\n }\n findTopMenu() {\n let parent = this.getParentComponent();\n if (!parent && this instanceof AgMenuList) {\n return this;\n }\n while (true) {\n const nextParent = parent && parent.getParentComponent && parent.getParentComponent();\n if (!nextParent || (!(nextParent instanceof AgMenuList || nextParent instanceof AgMenuItemComponent))) {\n break;\n }\n parent = nextParent;\n }\n return parent instanceof AgMenuList ? parent : undefined;\n }\n handleNavKey(key) {\n switch (key) {\n case KeyCode.UP:\n case KeyCode.DOWN:\n const nextItem = this.findNextItem(key === KeyCode.UP);\n if (nextItem && nextItem !== this.activeMenuItem) {\n nextItem.activate();\n }\n return;\n }\n const left = this.gridOptionsService.is('enableRtl') ? KeyCode.RIGHT : KeyCode.LEFT;\n if (key === left) {\n this.closeIfIsChild();\n }\n else {\n this.openChild();\n }\n }\n closeIfIsChild(e) {\n const parentItem = this.getParentComponent();\n if (parentItem && parentItem instanceof AgMenuItemComponent) {\n if (e) {\n e.preventDefault();\n }\n parentItem.closeSubMenu();\n parentItem.getGui().focus();\n }\n }\n openChild() {\n if (this.activeMenuItem) {\n this.activeMenuItem.openSubMenu(true);\n }\n }\n findNextItem(up) {\n const items = this.menuItems.filter(item => !item.isDisabled());\n if (!items.length) {\n return;\n }\n if (!this.activeMenuItem) {\n return up ? last(items) : items[0];\n }\n if (up) {\n items.reverse();\n }\n let nextItem;\n let foundCurrent = false;\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n if (!foundCurrent) {\n if (item === this.activeMenuItem) {\n foundCurrent = true;\n }\n continue;\n }\n nextItem = item;\n break;\n }\n return nextItem || this.activeMenuItem;\n }\n destroy() {\n this.clearActiveItem();\n super.destroy();\n }\n}\n__decorate([\n Autowired('focusService')\n], AgMenuList.prototype, \"focusService\", void 0);\n__decorate([\n PostConstruct\n], AgMenuList.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PostConstruct } from '../context/context.mjs';\nimport { KeyCode } from '../constants/keyCode.mjs';\nimport { TabGuardComp } from './tabGuardComp.mjs';\nexport class AgMenuPanel extends TabGuardComp {\n constructor(wrappedComponent) {\n super();\n this.wrappedComponent = wrappedComponent;\n this.setTemplateFromElement(wrappedComponent.getGui());\n }\n postConstruct() {\n this.initialiseTabGuard({\n onTabKeyDown: e => this.onTabKeyDown(e),\n handleKeyDown: e => this.handleKeyDown(e)\n });\n }\n handleKeyDown(e) {\n if (e.key === KeyCode.ESCAPE) {\n this.closePanel();\n }\n }\n onTabKeyDown(e) {\n if (e.defaultPrevented) {\n return;\n }\n this.closePanel();\n e.preventDefault();\n }\n closePanel() {\n const menuItem = this.parentComponent;\n menuItem.closeSubMenu();\n setTimeout(() => menuItem.getGui().focus(), 0);\n }\n}\n__decorate([\n PostConstruct\n], AgMenuPanel.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired } from '../context/context.mjs';\nimport { AgMenuList } from './agMenuList.mjs';\nimport { AgMenuPanel } from './agMenuPanel.mjs';\nimport { Component } from './component.mjs';\nimport { KeyCode } from '../constants/keyCode.mjs';\nimport { PostConstruct } from '../context/context.mjs';\nimport { createIconNoSpan } from '../utils/icon.mjs';\nimport { isNodeOrElement, loadTemplate } from '../utils/dom.mjs';\nimport { CustomTooltipFeature } from './customTooltipFeature.mjs';\nimport { getAriaLevel, setAriaDisabled, setAriaExpanded } from '../utils/aria.mjs';\nexport class AgMenuItemComponent extends Component {\n constructor(params) {\n super();\n this.params = params;\n this.isActive = false;\n this.subMenuIsOpen = false;\n this.setTemplate(/* html */ `
`);\n }\n init() {\n this.addIcon();\n this.addName();\n this.addShortcut();\n this.addSubMenu();\n this.addTooltip();\n const eGui = this.getGui();\n if (this.params.disabled) {\n this.addCssClass(this.getClassName('disabled'));\n setAriaDisabled(eGui, true);\n }\n else {\n this.addGuiEventListener('click', e => this.onItemSelected(e));\n this.addGuiEventListener('keydown', (e) => {\n if (e.key === KeyCode.ENTER || e.key === KeyCode.SPACE) {\n e.preventDefault();\n this.onItemSelected(e);\n }\n });\n this.addGuiEventListener('mousedown', e => {\n // Prevent event bubbling to other event handlers such as PopupService triggering\n // premature closing of any open sub-menu popup.\n e.stopPropagation();\n e.preventDefault();\n });\n this.addGuiEventListener('mouseenter', () => this.onMouseEnter());\n this.addGuiEventListener('mouseleave', () => this.onMouseLeave());\n }\n if (this.params.cssClasses) {\n this.params.cssClasses.forEach(it => this.addCssClass(it));\n }\n }\n isDisabled() {\n return !!this.params.disabled;\n }\n openSubMenu(activateFirstItem = false) {\n this.closeSubMenu();\n if (!this.params.subMenu) {\n return;\n }\n const ePopup = loadTemplate(/* html */ `
`);\n let destroySubMenu;\n if (this.params.subMenu instanceof Array) {\n const currentLevel = getAriaLevel(this.getGui());\n const nextLevel = isNaN(currentLevel) ? 1 : (currentLevel + 1);\n const childMenu = this.createBean(new AgMenuList(nextLevel));\n childMenu.setParentComponent(this);\n childMenu.addMenuItems(this.params.subMenu);\n ePopup.appendChild(childMenu.getGui());\n // bubble menu item selected events\n this.addManagedListener(childMenu, AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED, e => this.dispatchEvent(e));\n childMenu.addGuiEventListener('mouseenter', () => this.cancelDeactivate());\n destroySubMenu = () => this.destroyBean(childMenu);\n if (activateFirstItem) {\n setTimeout(() => childMenu.activateFirstItem(), 0);\n }\n }\n else {\n const { subMenu } = this.params;\n const menuPanel = this.createBean(new AgMenuPanel(subMenu));\n menuPanel.setParentComponent(this);\n const subMenuGui = menuPanel.getGui();\n const mouseEvent = 'mouseenter';\n const mouseEnterListener = () => this.cancelDeactivate();\n subMenuGui.addEventListener(mouseEvent, mouseEnterListener);\n destroySubMenu = () => subMenuGui.removeEventListener(mouseEvent, mouseEnterListener);\n ePopup.appendChild(subMenuGui);\n if (subMenu.afterGuiAttached) {\n setTimeout(() => subMenu.afterGuiAttached(), 0);\n }\n }\n const eGui = this.getGui();\n const positionCallback = this.popupService.positionPopupForMenu.bind(this.popupService, { eventSource: eGui, ePopup });\n const translate = this.localeService.getLocaleTextFunc();\n const addPopupRes = this.popupService.addPopup({\n modal: true,\n eChild: ePopup,\n positionCallback: positionCallback,\n anchorToElement: eGui,\n ariaLabel: translate('ariaLabelSubMenu', 'SubMenu')\n });\n this.subMenuIsOpen = true;\n setAriaExpanded(eGui, true);\n this.hideSubMenu = () => {\n if (addPopupRes) {\n addPopupRes.hideFunc();\n }\n this.subMenuIsOpen = false;\n setAriaExpanded(eGui, false);\n destroySubMenu();\n };\n }\n closeSubMenu() {\n if (!this.hideSubMenu) {\n return;\n }\n this.hideSubMenu();\n this.hideSubMenu = null;\n setAriaExpanded(this.getGui(), false);\n }\n isSubMenuOpen() {\n return this.subMenuIsOpen;\n }\n activate(openSubMenu) {\n this.cancelActivate();\n if (this.params.disabled) {\n return;\n }\n this.isActive = true;\n this.addCssClass(this.getClassName('active'));\n this.getGui().focus();\n if (openSubMenu && this.params.subMenu) {\n window.setTimeout(() => {\n if (this.isAlive() && this.isActive) {\n this.openSubMenu();\n }\n }, 300);\n }\n this.onItemActivated();\n }\n deactivate() {\n this.cancelDeactivate();\n this.removeCssClass(this.getClassName('active'));\n this.isActive = false;\n if (this.subMenuIsOpen) {\n this.hideSubMenu();\n }\n }\n addIcon() {\n if (!this.params.checked && !this.params.icon && this.params.isCompact) {\n return;\n }\n const icon = loadTemplate(/* html */ ``);\n if (this.params.checked) {\n icon.appendChild(createIconNoSpan('check', this.gridOptionsService));\n }\n else if (this.params.icon) {\n if (isNodeOrElement(this.params.icon)) {\n icon.appendChild(this.params.icon);\n }\n else if (typeof this.params.icon === 'string') {\n icon.innerHTML = this.params.icon;\n }\n else {\n console.warn('AG Grid: menu item icon must be DOM node or string');\n }\n }\n this.getGui().appendChild(icon);\n }\n addName() {\n if (!this.params.name && this.params.isCompact) {\n return;\n }\n const name = loadTemplate(/* html */ `${this.params.name || ''}`);\n this.getGui().appendChild(name);\n }\n addTooltip() {\n if (!this.params.tooltip) {\n return;\n }\n this.tooltip = this.params.tooltip;\n if (this.gridOptionsService.is('enableBrowserTooltips')) {\n this.getGui().setAttribute('title', this.tooltip);\n }\n else {\n this.createManagedBean(new CustomTooltipFeature(this));\n }\n }\n getTooltipParams() {\n return {\n location: 'menu',\n value: this.tooltip\n };\n }\n addShortcut() {\n if (!this.params.shortcut && this.params.isCompact) {\n return;\n }\n const shortcut = loadTemplate(/* html */ `${this.params.shortcut || ''}`);\n this.getGui().appendChild(shortcut);\n }\n addSubMenu() {\n if (!this.params.subMenu && this.params.isCompact) {\n return;\n }\n const pointer = loadTemplate(/* html */ ``);\n const eGui = this.getGui();\n if (this.params.subMenu) {\n const iconName = this.gridOptionsService.is('enableRtl') ? 'smallLeft' : 'smallRight';\n setAriaExpanded(eGui, false);\n pointer.appendChild(createIconNoSpan(iconName, this.gridOptionsService));\n }\n eGui.appendChild(pointer);\n }\n onItemSelected(event) {\n if (this.params.action) {\n this.params.action();\n }\n else {\n this.openSubMenu(event && event.type === 'keydown');\n }\n if (this.params.subMenu && !this.params.action) {\n return;\n }\n const e = {\n type: AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED,\n action: this.params.action,\n checked: this.params.checked,\n cssClasses: this.params.cssClasses,\n disabled: this.params.disabled,\n icon: this.params.icon,\n name: this.params.name,\n shortcut: this.params.shortcut,\n subMenu: this.params.subMenu,\n tooltip: this.params.tooltip,\n event\n };\n this.dispatchEvent(e);\n }\n onItemActivated() {\n const event = {\n type: AgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED,\n menuItem: this,\n };\n this.dispatchEvent(event);\n }\n cancelActivate() {\n if (this.activateTimeoutId) {\n window.clearTimeout(this.activateTimeoutId);\n this.activateTimeoutId = 0;\n }\n }\n cancelDeactivate() {\n if (this.deactivateTimeoutId) {\n window.clearTimeout(this.deactivateTimeoutId);\n this.deactivateTimeoutId = 0;\n }\n }\n onMouseEnter() {\n this.cancelDeactivate();\n if (this.params.isAnotherSubMenuOpen()) {\n // wait to see if the user enters the open sub-menu\n this.activateTimeoutId = window.setTimeout(() => this.activate(true), AgMenuItemComponent.ACTIVATION_DELAY);\n }\n else {\n // activate immediately\n this.activate(true);\n }\n }\n onMouseLeave() {\n this.cancelActivate();\n if (this.isSubMenuOpen()) {\n // wait to see if the user enters the sub-menu\n this.deactivateTimeoutId = window.setTimeout(() => this.deactivate(), AgMenuItemComponent.ACTIVATION_DELAY);\n }\n else {\n // de-activate immediately\n this.deactivate();\n }\n }\n getClassName(suffix) {\n const prefix = this.params.isCompact ? 'ag-compact-menu-option' : 'ag-menu-option';\n return suffix ? `${prefix}-${suffix}` : prefix;\n }\n}\nAgMenuItemComponent.EVENT_MENU_ITEM_SELECTED = 'menuItemSelected';\nAgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED = 'menuItemActivated';\nAgMenuItemComponent.ACTIVATION_DELAY = 80;\n__decorate([\n Autowired('popupService')\n], AgMenuItemComponent.prototype, \"popupService\", void 0);\n__decorate([\n PostConstruct\n], AgMenuItemComponent.prototype, \"init\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { RefSelector } from \"./componentAnnotations.mjs\";\nimport { PostConstruct } from \"../context/context.mjs\";\nimport { Component } from \"./component.mjs\";\nimport { getInnerHeight, getInnerWidth, setDisplayed } from \"../utils/dom.mjs\";\nimport { createIconNoSpan } from \"../utils/icon.mjs\";\nimport { PositionableFeature } from \"../rendering/features/positionableFeature.mjs\";\nexport class AgPanel extends Component {\n constructor(config) {\n super(AgPanel.getTemplate(config));\n this.closable = true;\n this.config = config;\n }\n static getTemplate(config) {\n const cssIdentifier = (config && config.cssIdentifier) || 'default';\n return /* html */ `
\n
\n \n
\n
\n
\n
`;\n }\n postConstruct() {\n const { component, closable, hideTitleBar, title, minWidth = 250, width, minHeight = 250, height, centered, popup, x, y } = this.config;\n this.positionableFeature = new PositionableFeature(this.getGui(), {\n minWidth, width, minHeight, height, centered, x, y, popup,\n calculateTopBuffer: () => this.positionableFeature.getHeight() - this.getBodyHeight()\n });\n this.createManagedBean(this.positionableFeature);\n const eGui = this.getGui();\n if (component) {\n this.setBodyComponent(component);\n }\n if (!hideTitleBar) {\n if (title) {\n this.setTitle(title);\n }\n this.setClosable(closable != null ? closable : this.closable);\n }\n else {\n setDisplayed(this.eTitleBar, false);\n }\n this.addManagedListener(this.eTitleBar, 'mousedown', (e) => {\n const eDocument = this.gridOptionsService.getDocument();\n if (eGui.contains(e.relatedTarget) ||\n eGui.contains(eDocument.activeElement) ||\n this.eTitleBarButtons.contains(e.target)) {\n e.preventDefault();\n return;\n }\n const focusEl = this.eContentWrapper.querySelector('button, [href], input, select, textarea, [tabindex]');\n if (focusEl) {\n focusEl.focus();\n }\n });\n if (popup && this.positionableFeature.isPositioned()) {\n return;\n }\n if (this.renderComponent) {\n this.renderComponent();\n }\n this.positionableFeature.initialisePosition();\n this.eContentWrapper.style.height = '0';\n }\n renderComponent() {\n const eGui = this.getGui();\n eGui.focus();\n this.close = () => {\n eGui.parentElement.removeChild(eGui);\n this.destroy();\n };\n }\n getHeight() {\n return this.positionableFeature.getHeight();\n }\n setHeight(height) {\n this.positionableFeature.setHeight(height);\n }\n getWidth() {\n return this.positionableFeature.getWidth();\n }\n setWidth(width) {\n this.positionableFeature.setWidth(width);\n }\n setClosable(closable) {\n if (closable !== this.closable) {\n this.closable = closable;\n }\n if (closable) {\n const closeButtonComp = this.closeButtonComp = new Component(AgPanel.CLOSE_BTN_TEMPLATE);\n this.getContext().createBean(closeButtonComp);\n const eGui = closeButtonComp.getGui();\n const child = createIconNoSpan('close', this.gridOptionsService);\n child.classList.add('ag-panel-title-bar-button-icon');\n eGui.appendChild(child);\n this.addTitleBarButton(closeButtonComp);\n closeButtonComp.addManagedListener(eGui, 'click', this.onBtClose.bind(this));\n }\n else if (this.closeButtonComp) {\n const eGui = this.closeButtonComp.getGui();\n eGui.parentElement.removeChild(eGui);\n this.closeButtonComp = this.destroyBean(this.closeButtonComp);\n }\n }\n setBodyComponent(bodyComponent) {\n bodyComponent.setParentComponent(this);\n this.eContentWrapper.appendChild(bodyComponent.getGui());\n }\n addTitleBarButton(button, position) {\n const eTitleBarButtons = this.eTitleBarButtons;\n const buttons = eTitleBarButtons.children;\n const len = buttons.length;\n if (position == null) {\n position = len;\n }\n position = Math.max(0, Math.min(position, len));\n button.addCssClass('ag-panel-title-bar-button');\n const eGui = button.getGui();\n if (position === 0) {\n eTitleBarButtons.insertAdjacentElement('afterbegin', eGui);\n }\n else if (position === len) {\n eTitleBarButtons.insertAdjacentElement('beforeend', eGui);\n }\n else {\n buttons[position - 1].insertAdjacentElement('afterend', eGui);\n }\n button.setParentComponent(this);\n }\n getBodyHeight() {\n return getInnerHeight(this.eContentWrapper);\n }\n getBodyWidth() {\n return getInnerWidth(this.eContentWrapper);\n }\n setTitle(title) {\n this.eTitle.innerText = title;\n }\n // called when user hits the 'x' in the top right\n onBtClose() {\n this.close();\n }\n destroy() {\n if (this.closeButtonComp) {\n this.closeButtonComp = this.destroyBean(this.closeButtonComp);\n }\n const eGui = this.getGui();\n if (eGui && eGui.offsetParent) {\n this.close();\n }\n super.destroy();\n }\n}\nAgPanel.CLOSE_BTN_TEMPLATE = `
`;\n__decorate([\n RefSelector('eContentWrapper')\n], AgPanel.prototype, \"eContentWrapper\", void 0);\n__decorate([\n RefSelector('eTitleBar')\n], AgPanel.prototype, \"eTitleBar\", void 0);\n__decorate([\n RefSelector('eTitleBarButtons')\n], AgPanel.prototype, \"eTitleBarButtons\", void 0);\n__decorate([\n RefSelector('eTitle')\n], AgPanel.prototype, \"eTitle\", void 0);\n__decorate([\n PostConstruct\n], AgPanel.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired } from \"../context/context.mjs\";\nimport { AgPanel } from \"./agPanel.mjs\";\nimport { Component } from \"./component.mjs\";\nimport { setDisplayed } from \"../utils/dom.mjs\";\nimport { createIconNoSpan } from \"../utils/icon.mjs\";\nexport class AgDialog extends AgPanel {\n constructor(config) {\n super(Object.assign(Object.assign({}, config), { popup: true }));\n this.isMaximizable = false;\n this.isMaximized = false;\n this.maximizeListeners = [];\n this.resizeListenerDestroy = null;\n this.lastPosition = {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n };\n }\n postConstruct() {\n const eGui = this.getGui();\n const { movable, resizable, maximizable } = this.config;\n this.addCssClass('ag-dialog');\n super.postConstruct();\n this.addManagedListener(eGui, 'focusin', (e) => {\n if (eGui.contains(e.relatedTarget)) {\n return;\n }\n this.popupService.bringPopupToFront(eGui);\n });\n if (movable) {\n this.setMovable(movable);\n }\n if (maximizable) {\n this.setMaximizable(maximizable);\n }\n if (resizable) {\n this.setResizable(resizable);\n }\n }\n renderComponent() {\n const eGui = this.getGui();\n const { alwaysOnTop, modal, title } = this.config;\n const translate = this.localeService.getLocaleTextFunc();\n const addPopupRes = this.popupService.addPopup({\n modal,\n eChild: eGui,\n closeOnEsc: true,\n closedCallback: this.destroy.bind(this),\n alwaysOnTop,\n ariaLabel: title || translate('ariaLabelDialog', 'Dialog')\n });\n if (addPopupRes) {\n this.close = addPopupRes.hideFunc;\n }\n }\n toggleMaximize() {\n const position = this.positionableFeature.getPosition();\n if (this.isMaximized) {\n const { x, y, width, height } = this.lastPosition;\n this.setWidth(width);\n this.setHeight(height);\n this.positionableFeature.offsetElement(x, y);\n }\n else {\n this.lastPosition.width = this.getWidth();\n this.lastPosition.height = this.getHeight();\n this.lastPosition.x = position.x;\n this.lastPosition.y = position.y;\n this.positionableFeature.offsetElement(0, 0);\n this.setHeight('100%');\n this.setWidth('100%');\n }\n this.isMaximized = !this.isMaximized;\n this.refreshMaximizeIcon();\n }\n refreshMaximizeIcon() {\n setDisplayed(this.maximizeIcon, !this.isMaximized);\n setDisplayed(this.minimizeIcon, this.isMaximized);\n }\n clearMaximizebleListeners() {\n if (this.maximizeListeners.length) {\n this.maximizeListeners.forEach(destroyListener => destroyListener());\n this.maximizeListeners.length = 0;\n }\n if (this.resizeListenerDestroy) {\n this.resizeListenerDestroy();\n this.resizeListenerDestroy = null;\n }\n }\n destroy() {\n this.maximizeButtonComp = this.destroyBean(this.maximizeButtonComp);\n this.clearMaximizebleListeners();\n super.destroy();\n }\n setResizable(resizable) {\n this.positionableFeature.setResizable(resizable);\n }\n setMovable(movable) {\n this.positionableFeature.setMovable(movable, this.eTitleBar);\n }\n setMaximizable(maximizable) {\n if (!maximizable) {\n this.clearMaximizebleListeners();\n if (this.maximizeButtonComp) {\n this.destroyBean(this.maximizeButtonComp);\n this.maximizeButtonComp = this.maximizeIcon = this.minimizeIcon = undefined;\n }\n return;\n }\n const eTitleBar = this.eTitleBar;\n if (!eTitleBar || maximizable === this.isMaximizable) {\n return;\n }\n const maximizeButtonComp = this.buildMaximizeAndMinimizeElements();\n this.refreshMaximizeIcon();\n maximizeButtonComp.addManagedListener(maximizeButtonComp.getGui(), 'click', this.toggleMaximize.bind(this));\n this.addTitleBarButton(maximizeButtonComp, 0);\n this.maximizeListeners.push(this.addManagedListener(eTitleBar, 'dblclick', this.toggleMaximize.bind(this)));\n this.resizeListenerDestroy = this.addManagedListener(this, 'resize', () => {\n this.isMaximized = false;\n this.refreshMaximizeIcon();\n });\n }\n buildMaximizeAndMinimizeElements() {\n const maximizeButtonComp = this.maximizeButtonComp =\n this.createBean(new Component(/* html */ `
`));\n const eGui = maximizeButtonComp.getGui();\n this.maximizeIcon = createIconNoSpan('maximize', this.gridOptionsService);\n eGui.appendChild(this.maximizeIcon);\n this.maximizeIcon.classList.add('ag-panel-title-bar-button-icon');\n this.minimizeIcon = createIconNoSpan('minimize', this.gridOptionsService);\n eGui.appendChild(this.minimizeIcon);\n this.minimizeIcon.classList.add('ag-panel-title-bar-button-icon');\n return maximizeButtonComp;\n }\n}\n__decorate([\n Autowired('popupService')\n], AgDialog.prototype, \"popupService\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar PopupService_1;\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { Events } from '../events.mjs';\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { getAbsoluteHeight, getAbsoluteWidth, getElementRectWithOffset } from '../utils/dom.mjs';\nimport { last } from '../utils/array.mjs';\nimport { isElementInEventPath } from '../utils/event.mjs';\nimport { KeyCode } from '../constants/keyCode.mjs';\nimport { FocusService } from \"../focusService.mjs\";\nimport { AgPromise } from \"../utils/index.mjs\";\nimport { setAriaLabel, setAriaRole } from \"../utils/aria.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nvar DIRECTION;\n(function (DIRECTION) {\n DIRECTION[DIRECTION[\"vertical\"] = 0] = \"vertical\";\n DIRECTION[DIRECTION[\"horizontal\"] = 1] = \"horizontal\";\n})(DIRECTION || (DIRECTION = {}));\nlet instanceIdSeq = 0;\nlet PopupService = PopupService_1 = class PopupService extends BeanStub {\n constructor() {\n super(...arguments);\n this.popupList = [];\n }\n postConstruct() {\n this.ctrlsService.whenReady(p => {\n this.gridCtrl = p.gridCtrl;\n this.addManagedListener(this.gridCtrl, Events.EVENT_KEYBOARD_FOCUS, () => {\n this.popupList.forEach(popup => popup.element.classList.add(FocusService.AG_KEYBOARD_FOCUS));\n });\n this.addManagedListener(this.gridCtrl, Events.EVENT_MOUSE_FOCUS, () => {\n this.popupList.forEach(popup => popup.element.classList.remove(FocusService.AG_KEYBOARD_FOCUS));\n });\n });\n }\n getPopupParent() {\n const ePopupParent = this.gridOptionsService.get('popupParent');\n if (ePopupParent) {\n return ePopupParent;\n }\n return this.gridCtrl.getGui();\n }\n positionPopupForMenu(params) {\n const { eventSource, ePopup } = params;\n const popupIdx = this.getPopupIndex(ePopup);\n if (popupIdx !== -1) {\n const popup = this.popupList[popupIdx];\n popup.alignedToElement = eventSource;\n }\n const sourceRect = eventSource.getBoundingClientRect();\n const parentRect = this.getParentRect();\n const y = this.keepXYWithinBounds(ePopup, sourceRect.top - parentRect.top, DIRECTION.vertical);\n const minWidth = (ePopup.clientWidth > 0) ? ePopup.clientWidth : 200;\n ePopup.style.minWidth = `${minWidth}px`;\n const widthOfParent = parentRect.right - parentRect.left;\n const maxX = widthOfParent - minWidth;\n // the x position of the popup depends on RTL or LTR. for normal cases, LTR, we put the child popup\n // to the right, unless it doesn't fit and we then put it to the left. for RTL it's the other way around,\n // we try place it first to the left, and then if not to the right.\n let x;\n if (this.gridOptionsService.is('enableRtl')) {\n // for RTL, try left first\n x = xLeftPosition();\n if (x < 0) {\n x = xRightPosition();\n this.setAlignedStyles(ePopup, 'left');\n }\n if (x > maxX) {\n x = 0;\n this.setAlignedStyles(ePopup, 'right');\n }\n }\n else {\n // for LTR, try right first\n x = xRightPosition();\n if (x > maxX) {\n x = xLeftPosition();\n this.setAlignedStyles(ePopup, 'right');\n }\n if (x < 0) {\n x = 0;\n this.setAlignedStyles(ePopup, 'left');\n }\n }\n ePopup.style.left = `${x}px`;\n ePopup.style.top = `${y}px`;\n function xRightPosition() {\n return sourceRect.right - parentRect.left - 2;\n }\n function xLeftPosition() {\n return sourceRect.left - parentRect.left - minWidth;\n }\n }\n positionPopupUnderMouseEvent(params) {\n const { ePopup, nudgeX, nudgeY, skipObserver } = params;\n this.positionPopup({\n ePopup: ePopup,\n nudgeX,\n nudgeY,\n keepWithinBounds: true,\n skipObserver,\n updatePosition: () => this.calculatePointerAlign(params.mouseEvent),\n postProcessCallback: () => this.callPostProcessPopup(params.type, params.ePopup, null, params.mouseEvent, params.column, params.rowNode)\n });\n }\n calculatePointerAlign(e) {\n const parentRect = this.getParentRect();\n return {\n x: e.clientX - parentRect.left,\n y: e.clientY - parentRect.top\n };\n }\n positionPopupByComponent(params) {\n const { ePopup, nudgeX, nudgeY, keepWithinBounds, eventSource, alignSide = 'left', position = 'over', column, rowNode, type } = params;\n const sourceRect = eventSource.getBoundingClientRect();\n const parentRect = this.getParentRect();\n const popupIdx = this.getPopupIndex(ePopup);\n if (popupIdx !== -1) {\n const popup = this.popupList[popupIdx];\n popup.alignedToElement = eventSource;\n }\n const updatePosition = () => {\n let x = sourceRect.left - parentRect.left;\n if (alignSide === 'right') {\n x -= (ePopup.offsetWidth - sourceRect.width);\n }\n let y;\n if (position === 'over') {\n y = (sourceRect.top - parentRect.top);\n this.setAlignedStyles(ePopup, 'over');\n }\n else {\n this.setAlignedStyles(ePopup, 'under');\n const alignSide = this.shouldRenderUnderOrAbove(ePopup, sourceRect, parentRect, params.nudgeY || 0);\n if (alignSide === 'under') {\n y = (sourceRect.top - parentRect.top + sourceRect.height);\n }\n else {\n y = (sourceRect.top - ePopup.offsetHeight - (nudgeY || 0) * 2) - parentRect.top;\n }\n }\n return { x, y };\n };\n this.positionPopup({\n ePopup,\n nudgeX,\n nudgeY,\n keepWithinBounds,\n updatePosition,\n postProcessCallback: () => this.callPostProcessPopup(type, ePopup, eventSource, null, column, rowNode)\n });\n }\n shouldRenderUnderOrAbove(ePopup, targetCompRect, parentRect, nudgeY) {\n const spaceAvailableUnder = parentRect.bottom - targetCompRect.bottom;\n const spaceAvailableAbove = targetCompRect.top - parentRect.top;\n const spaceRequired = ePopup.offsetHeight + nudgeY;\n if (spaceAvailableUnder > spaceRequired) {\n return 'under';\n }\n if (spaceAvailableAbove > spaceRequired || spaceAvailableAbove > spaceAvailableUnder) {\n return 'above';\n }\n return 'under';\n }\n setAlignedStyles(ePopup, positioned) {\n const popupIdx = this.getPopupIndex(ePopup);\n if (popupIdx === -1) {\n return;\n }\n const popup = this.popupList[popupIdx];\n const { alignedToElement } = popup;\n if (!alignedToElement) {\n return;\n }\n const positions = ['right', 'left', 'over', 'above', 'under'];\n positions.forEach(position => {\n alignedToElement.classList.remove(`ag-has-popup-positioned-${position}`);\n ePopup.classList.remove(`ag-popup-positioned-${position}`);\n });\n if (!positioned) {\n return;\n }\n alignedToElement.classList.add(`ag-has-popup-positioned-${positioned}`);\n ePopup.classList.add(`ag-popup-positioned-${positioned}`);\n }\n callPostProcessPopup(type, ePopup, eventSource, mouseEvent, column, rowNode) {\n const callback = this.gridOptionsService.getCallback('postProcessPopup');\n if (callback) {\n const params = {\n column: column,\n rowNode: rowNode,\n ePopup: ePopup,\n type: type,\n eventSource: eventSource,\n mouseEvent: mouseEvent\n };\n callback(params);\n }\n }\n positionPopup(params) {\n const { ePopup, keepWithinBounds, nudgeX, nudgeY, skipObserver, updatePosition } = params;\n const lastSize = { width: 0, height: 0 };\n const updatePopupPosition = (fromResizeObserver = false) => {\n let { x, y } = updatePosition();\n if (fromResizeObserver &&\n ePopup.clientWidth === lastSize.width &&\n ePopup.clientHeight === lastSize.height) {\n return;\n }\n lastSize.width = ePopup.clientWidth;\n lastSize.height = ePopup.clientHeight;\n if (nudgeX) {\n x += nudgeX;\n }\n if (nudgeY) {\n y += nudgeY;\n }\n // if popup is overflowing to the bottom, move it up\n if (keepWithinBounds) {\n x = this.keepXYWithinBounds(ePopup, x, DIRECTION.horizontal);\n y = this.keepXYWithinBounds(ePopup, y, DIRECTION.vertical);\n }\n ePopup.style.left = `${x}px`;\n ePopup.style.top = `${y}px`;\n if (params.postProcessCallback) {\n params.postProcessCallback();\n }\n };\n updatePopupPosition();\n // Mouse tracking will recalculate positioning when moving, so won't need to recalculate here\n if (!skipObserver) {\n // Since rendering popup contents can be asynchronous, use a resize observer to\n // reposition the popup after initial updates to the size of the contents\n const resizeObserverDestroyFunc = this.resizeObserverService.observeResize(ePopup, () => updatePopupPosition(true));\n // Only need to reposition when first open, so can clean up after a bit of time\n setTimeout(() => resizeObserverDestroyFunc(), PopupService_1.WAIT_FOR_POPUP_CONTENT_RESIZE);\n }\n }\n getActivePopups() {\n return this.popupList.map((popup) => popup.element);\n }\n getPopupList() {\n return this.popupList;\n }\n getParentRect() {\n // subtract the popup parent borders, because popupParent.getBoundingClientRect\n // returns the rect outside the borders, but the 0,0 coordinate for absolute\n // positioning is inside the border, leading the popup to be off by the width\n // of the border\n const eDocument = this.gridOptionsService.getDocument();\n let popupParent = this.getPopupParent();\n if (popupParent === eDocument.body) {\n popupParent = eDocument.documentElement;\n }\n else if (getComputedStyle(popupParent).position === 'static') {\n popupParent = popupParent.offsetParent;\n }\n return getElementRectWithOffset(popupParent);\n }\n keepXYWithinBounds(ePopup, position, direction) {\n const isVertical = direction === DIRECTION.vertical;\n const sizeProperty = isVertical ? 'clientHeight' : 'clientWidth';\n const anchorProperty = isVertical ? 'top' : 'left';\n const offsetProperty = isVertical ? 'offsetHeight' : 'offsetWidth';\n const scrollPositionProperty = isVertical ? 'scrollTop' : 'scrollLeft';\n const eDocument = this.gridOptionsService.getDocument();\n const docElement = eDocument.documentElement;\n const popupParent = this.getPopupParent();\n const parentRect = popupParent.getBoundingClientRect();\n const documentRect = eDocument.documentElement.getBoundingClientRect();\n const isBody = popupParent === eDocument.body;\n const offsetSize = ePopup[offsetProperty];\n const getSize = isVertical ? getAbsoluteHeight : getAbsoluteWidth;\n let sizeOfParent = isBody ? (getSize(docElement) + docElement[scrollPositionProperty]) : popupParent[sizeProperty];\n if (isBody) {\n sizeOfParent -= Math.abs(documentRect[anchorProperty] - parentRect[anchorProperty]);\n }\n const max = sizeOfParent - offsetSize;\n return Math.min(Math.max(position, 0), Math.abs(max));\n }\n addPopup(params) {\n const eDocument = this.gridOptionsService.getDocument();\n const { eChild, ariaLabel, alwaysOnTop, positionCallback, anchorToElement } = params;\n if (!eDocument) {\n console.warn('AG Grid: could not find the document, document is empty');\n return { hideFunc: () => { } };\n }\n const pos = this.getPopupIndex(eChild);\n if (pos !== -1) {\n const popup = this.popupList[pos];\n return { hideFunc: popup.hideFunc };\n }\n this.initialisePopupPosition(eChild);\n const wrapperEl = this.createPopupWrapper(eChild, ariaLabel, !!alwaysOnTop);\n const removeListeners = this.addEventListenersToPopup(Object.assign(Object.assign({}, params), { wrapperEl }));\n if (positionCallback) {\n positionCallback();\n }\n this.addPopupToPopupList(eChild, wrapperEl, removeListeners, anchorToElement);\n return {\n hideFunc: removeListeners\n };\n }\n initialisePopupPosition(element) {\n const ePopupParent = this.getPopupParent();\n const ePopupParentRect = ePopupParent.getBoundingClientRect();\n if (!exists(element.style.top)) {\n element.style.top = `${ePopupParentRect.top * -1}px`;\n }\n if (!exists(element.style.left)) {\n element.style.left = `${ePopupParentRect.left * -1}px`;\n }\n }\n createPopupWrapper(element, ariaLabel, alwaysOnTop) {\n const ePopupParent = this.getPopupParent();\n // add env CSS class to child, in case user provided a popup parent, which means\n // theme class may be missing\n const eWrapper = document.createElement('div');\n const { allThemes } = this.environment.getTheme();\n if (allThemes.length) {\n eWrapper.classList.add(...allThemes);\n }\n eWrapper.classList.add('ag-popup');\n element.classList.add(this.gridOptionsService.is('enableRtl') ? 'ag-rtl' : 'ag-ltr', 'ag-popup-child');\n if (!element.hasAttribute('role')) {\n setAriaRole(element, 'dialog');\n }\n setAriaLabel(element, ariaLabel);\n if (this.focusService.isKeyboardMode()) {\n element.classList.add(FocusService.AG_KEYBOARD_FOCUS);\n }\n eWrapper.appendChild(element);\n ePopupParent.appendChild(eWrapper);\n if (alwaysOnTop) {\n this.setAlwaysOnTop(element, true);\n }\n else {\n this.bringPopupToFront(element);\n }\n return eWrapper;\n }\n addEventListenersToPopup(params) {\n const eDocument = this.gridOptionsService.getDocument();\n const ePopupParent = this.getPopupParent();\n const { wrapperEl, eChild: popupEl, click: pointerEvent, closedCallback, afterGuiAttached, closeOnEsc, modal } = params;\n let popupHidden = false;\n const hidePopupOnKeyboardEvent = (event) => {\n if (!wrapperEl.contains(eDocument.activeElement)) {\n return;\n }\n const key = event.key;\n if (key === KeyCode.ESCAPE) {\n removeListeners({ keyboardEvent: event });\n }\n };\n const hidePopupOnMouseEvent = (event) => removeListeners({ mouseEvent: event });\n const hidePopupOnTouchEvent = (event) => removeListeners({ touchEvent: event });\n const removeListeners = (popupParams = {}) => {\n const { mouseEvent, touchEvent, keyboardEvent } = popupParams;\n if (\n // we don't hide popup if the event was on the child, or any\n // children of this child\n this.isEventFromCurrentPopup({ mouseEvent, touchEvent }, popupEl) ||\n // if the event to close is actually the open event, then ignore it\n this.isEventSameChainAsOriginalEvent({ originalMouseEvent: pointerEvent, mouseEvent, touchEvent }) ||\n // this method should only be called once. the client can have different\n // paths, each one wanting to close, so this method may be called multiple times.\n popupHidden) {\n return;\n }\n popupHidden = true;\n ePopupParent.removeChild(wrapperEl);\n eDocument.removeEventListener('keydown', hidePopupOnKeyboardEvent);\n eDocument.removeEventListener('mousedown', hidePopupOnMouseEvent);\n eDocument.removeEventListener('touchstart', hidePopupOnTouchEvent);\n eDocument.removeEventListener('contextmenu', hidePopupOnMouseEvent);\n this.eventService.removeEventListener(Events.EVENT_DRAG_STARTED, hidePopupOnMouseEvent);\n if (closedCallback) {\n closedCallback(mouseEvent || touchEvent || keyboardEvent);\n }\n this.removePopupFromPopupList(popupEl);\n };\n if (afterGuiAttached) {\n afterGuiAttached({ hidePopup: removeListeners });\n }\n // if we add these listeners now, then the current mouse\n // click will be included, which we don't want\n window.setTimeout(() => {\n if (closeOnEsc) {\n eDocument.addEventListener('keydown', hidePopupOnKeyboardEvent);\n }\n if (modal) {\n eDocument.addEventListener('mousedown', hidePopupOnMouseEvent);\n this.eventService.addEventListener(Events.EVENT_DRAG_STARTED, hidePopupOnMouseEvent);\n eDocument.addEventListener('touchstart', hidePopupOnTouchEvent);\n eDocument.addEventListener('contextmenu', hidePopupOnMouseEvent);\n }\n }, 0);\n return removeListeners;\n }\n addPopupToPopupList(element, wrapperEl, removeListeners, anchorToElement) {\n this.popupList.push({\n element: element,\n wrapper: wrapperEl,\n hideFunc: removeListeners,\n instanceId: instanceIdSeq++,\n isAnchored: !!anchorToElement\n });\n if (anchorToElement) {\n this.setPopupPositionRelatedToElement(element, anchorToElement);\n }\n }\n getPopupIndex(el) {\n return this.popupList.findIndex(p => p.element === el);\n }\n setPopupPositionRelatedToElement(popupEl, relativeElement) {\n const popupIndex = this.getPopupIndex(popupEl);\n if (popupIndex === -1) {\n return;\n }\n const popup = this.popupList[popupIndex];\n if (popup.stopAnchoringPromise) {\n popup.stopAnchoringPromise.then(destroyFunc => destroyFunc && destroyFunc());\n }\n popup.stopAnchoringPromise = undefined;\n popup.isAnchored = false;\n if (!relativeElement) {\n return;\n }\n // keeps popup positioned under created, eg if context menu, if user scrolls\n // using touchpad and the cell moves, it moves the popup to keep it with the cell.\n const destroyPositionTracker = this.keepPopupPositionedRelativeTo({\n element: relativeElement,\n ePopup: popupEl,\n hidePopup: popup.hideFunc\n });\n popup.stopAnchoringPromise = destroyPositionTracker;\n popup.isAnchored = true;\n return destroyPositionTracker;\n }\n removePopupFromPopupList(element) {\n this.setAlignedStyles(element, null);\n this.setPopupPositionRelatedToElement(element, null);\n this.popupList = this.popupList.filter(p => p.element !== element);\n }\n keepPopupPositionedRelativeTo(params) {\n const eParent = this.getPopupParent();\n const parentRect = eParent.getBoundingClientRect();\n const { element, ePopup } = params;\n const sourceRect = element.getBoundingClientRect();\n const initialDiffTop = parentRect.top - sourceRect.top;\n const initialDiffLeft = parentRect.left - sourceRect.left;\n let lastDiffTop = initialDiffTop;\n let lastDiffLeft = initialDiffLeft;\n const topPx = ePopup.style.top;\n const top = parseInt(topPx.substring(0, topPx.length - 1), 10);\n const leftPx = ePopup.style.left;\n const left = parseInt(leftPx.substring(0, leftPx.length - 1), 10);\n return new AgPromise(resolve => {\n this.getFrameworkOverrides().setInterval(() => {\n const pRect = eParent.getBoundingClientRect();\n const sRect = element.getBoundingClientRect();\n const elementNotInDom = sRect.top == 0 && sRect.left == 0 && sRect.height == 0 && sRect.width == 0;\n if (elementNotInDom) {\n params.hidePopup();\n return;\n }\n const currentDiffTop = pRect.top - sRect.top;\n if (currentDiffTop != lastDiffTop) {\n const newTop = this.keepXYWithinBounds(ePopup, top + initialDiffTop - currentDiffTop, DIRECTION.vertical);\n ePopup.style.top = `${newTop}px`;\n }\n lastDiffTop = currentDiffTop;\n const currentDiffLeft = pRect.left - sRect.left;\n if (currentDiffLeft != lastDiffLeft) {\n const newLeft = this.keepXYWithinBounds(ePopup, left + initialDiffLeft - currentDiffLeft, DIRECTION.horizontal);\n ePopup.style.left = `${newLeft}px`;\n }\n lastDiffLeft = currentDiffLeft;\n }, 200).then(intervalId => {\n const result = () => {\n if (intervalId != null) {\n window.clearInterval(intervalId);\n }\n };\n resolve(result);\n });\n });\n }\n hasAnchoredPopup() {\n return this.popupList.some(popup => popup.isAnchored);\n }\n isEventFromCurrentPopup(params, target) {\n const { mouseEvent, touchEvent } = params;\n const event = mouseEvent ? mouseEvent : touchEvent;\n if (!event) {\n return false;\n }\n const indexOfThisChild = this.getPopupIndex(target);\n if (indexOfThisChild === -1) {\n return false;\n }\n for (let i = indexOfThisChild; i < this.popupList.length; i++) {\n const popup = this.popupList[i];\n if (isElementInEventPath(popup.element, event)) {\n return true;\n }\n }\n // if the user did not write their own Custom Element to be rendered as popup\n // and this component has an additional popup element, they should have the\n // `ag-custom-component-popup` class to be detected as part of the Custom Component\n return this.isElementWithinCustomPopup(event.target);\n }\n isElementWithinCustomPopup(el) {\n const eDocument = this.gridOptionsService.getDocument();\n while (el && el !== eDocument.body) {\n if (el.classList.contains('ag-custom-component-popup') || el.parentElement === null) {\n return true;\n }\n el = el.parentElement;\n }\n return false;\n }\n // in some browsers, the context menu event can be fired before the click event, which means\n // the context menu event could open the popup, but then the click event closes it straight away.\n isEventSameChainAsOriginalEvent(params) {\n const { originalMouseEvent, mouseEvent, touchEvent } = params;\n // we check the coordinates of the event, to see if it's the same event. there is a 1 / 1000 chance that\n // the event is a different event, however that is an edge case that is not very relevant (the user clicking\n // twice on the same location isn't a normal path).\n // event could be mouse event or touch event.\n let mouseEventOrTouch = null;\n if (mouseEvent) {\n // mouse event can be used direction, it has coordinates\n mouseEventOrTouch = mouseEvent;\n }\n else if (touchEvent) {\n // touch event doesn't have coordinates, need it's touch object\n mouseEventOrTouch = touchEvent.touches[0];\n }\n if (mouseEventOrTouch && originalMouseEvent) {\n // for x, allow 4px margin, to cover iPads, where touch (which opens menu) is followed\n // by browser click (when you finger up, touch is interrupted as click in browser)\n const screenX = mouseEvent ? mouseEvent.screenX : 0;\n const screenY = mouseEvent ? mouseEvent.screenY : 0;\n const xMatch = Math.abs(originalMouseEvent.screenX - screenX) < 5;\n const yMatch = Math.abs(originalMouseEvent.screenY - screenY) < 5;\n if (xMatch && yMatch) {\n return true;\n }\n }\n return false;\n }\n getWrapper(ePopup) {\n while (!ePopup.classList.contains('ag-popup') && ePopup.parentElement) {\n ePopup = ePopup.parentElement;\n }\n return ePopup.classList.contains('ag-popup') ? ePopup : null;\n }\n setAlwaysOnTop(ePopup, alwaysOnTop) {\n const eWrapper = this.getWrapper(ePopup);\n if (!eWrapper) {\n return;\n }\n eWrapper.classList.toggle('ag-always-on-top', !!alwaysOnTop);\n if (alwaysOnTop) {\n this.bringPopupToFront(eWrapper);\n }\n }\n bringPopupToFront(ePopup) {\n const parent = this.getPopupParent();\n const popupList = Array.prototype.slice.call(parent.querySelectorAll('.ag-popup'));\n const popupLen = popupList.length;\n const alwaysOnTopList = Array.prototype.slice.call(parent.querySelectorAll('.ag-popup.ag-always-on-top'));\n const onTopLength = alwaysOnTopList.length;\n const eWrapper = this.getWrapper(ePopup);\n if (!eWrapper || popupLen <= 1 || !parent.contains(ePopup)) {\n return;\n }\n const pos = popupList.indexOf(eWrapper);\n const innerEls = eWrapper.querySelectorAll('div');\n const innerElsScrollMap = [];\n innerEls.forEach(el => {\n if (el.scrollTop !== 0) {\n innerElsScrollMap.push([el, el.scrollTop]);\n }\n });\n if (onTopLength) {\n const isPopupAlwaysOnTop = eWrapper.classList.contains('ag-always-on-top');\n if (isPopupAlwaysOnTop) {\n if (pos !== popupLen - 1) {\n last(alwaysOnTopList).insertAdjacentElement('afterend', eWrapper);\n }\n }\n else if (pos !== popupLen - onTopLength - 1) {\n alwaysOnTopList[0].insertAdjacentElement('beforebegin', eWrapper);\n }\n }\n else if (pos !== popupLen - 1) {\n last(popupList).insertAdjacentElement('afterend', eWrapper);\n }\n while (innerElsScrollMap.length) {\n const currentEl = innerElsScrollMap.pop();\n currentEl[0].scrollTop = currentEl[1];\n }\n const params = {\n type: 'popupToFront',\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n eWrapper\n };\n this.eventService.dispatchEvent(params);\n }\n};\nPopupService.WAIT_FOR_POPUP_CONTENT_RESIZE = 200;\n__decorate([\n Autowired('focusService')\n], PopupService.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], PopupService.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('resizeObserverService')\n], PopupService.prototype, \"resizeObserverService\", void 0);\n__decorate([\n PostConstruct\n], PopupService.prototype, \"postConstruct\", null);\nPopupService = PopupService_1 = __decorate([\n Bean('popupService')\n], PopupService);\nexport { PopupService };\n","import { escapeString } from \"../utils/string.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nimport { Component } from \"./component.mjs\";\nexport class AgAutocompleteRow extends Component {\n constructor() {\n super(/* html */ `\n
\n
\n
`);\n this.hasHighlighting = false;\n }\n setState(value, selected) {\n this.value = value;\n this.render();\n this.updateSelected(selected);\n }\n updateSelected(selected) {\n this.addOrRemoveCssClass('ag-autocomplete-row-selected', selected);\n }\n setSearchString(searchString) {\n var _a;\n let keepHighlighting = false;\n if (exists(searchString)) {\n const index = (_a = this.value) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase().indexOf(searchString.toLocaleLowerCase());\n if (index >= 0) {\n keepHighlighting = true;\n this.hasHighlighting = true;\n const highlightEndIndex = index + searchString.length;\n const startPart = escapeString(this.value.slice(0, index));\n const highlightedPart = escapeString(this.value.slice(index, highlightEndIndex));\n const endPart = escapeString(this.value.slice(highlightEndIndex));\n this.getGui().lastElementChild.innerHTML = `${startPart}${highlightedPart}${endPart}`;\n }\n }\n if (!keepHighlighting && this.hasHighlighting) {\n this.hasHighlighting = false;\n this.render();\n }\n }\n render() {\n var _a;\n // putting in blank if missing, so at least the user can click on it\n this.getGui().lastElementChild.innerHTML = (_a = escapeString(this.value)) !== null && _a !== void 0 ? _a : ' ';\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { RefSelector } from \"./componentAnnotations.mjs\";\nimport { VirtualList } from \"./virtualList.mjs\";\nimport { KeyCode } from \"../constants/keyCode.mjs\";\nimport { AgAutocompleteRow } from \"./agAutocompleteRow.mjs\";\nimport { fuzzySuggestions } from \"../utils/fuzzyMatch.mjs\";\nimport { PopupComponent } from \"./popupComponent.mjs\";\nimport { PostConstruct } from \"../context/context.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nexport class AgAutocompleteList extends PopupComponent {\n constructor(params) {\n super(AgAutocompleteList.TEMPLATE);\n this.params = params;\n this.searchString = '';\n }\n destroy() {\n super.destroy();\n }\n init() {\n this.autocompleteEntries = this.params.autocompleteEntries;\n this.virtualList = this.createManagedBean(new VirtualList({ cssIdentifier: 'autocomplete' }));\n this.virtualList.setComponentCreator(this.createRowComponent.bind(this));\n this.eList.appendChild(this.virtualList.getGui());\n this.virtualList.setModel({\n getRowCount: () => this.autocompleteEntries.length,\n getRow: (index) => this.autocompleteEntries[index]\n });\n const virtualListGui = this.virtualList.getGui();\n this.addManagedListener(virtualListGui, 'click', () => this.params.onConfirmed());\n this.addManagedListener(virtualListGui, 'mousemove', this.onMouseMove.bind(this));\n this.addManagedListener(virtualListGui, 'mousedown', (e) => e.preventDefault());\n this.setSelectedValue(0);\n }\n onNavigationKeyDown(event, key) {\n // if we don't preventDefault the page body and/or grid scroll will move.\n event.preventDefault();\n const oldIndex = this.autocompleteEntries.indexOf(this.selectedValue);\n const newIndex = key === KeyCode.UP ? oldIndex - 1 : oldIndex + 1;\n this.checkSetSelectedValue(newIndex);\n }\n setSearch(searchString) {\n this.searchString = searchString;\n if (exists(searchString)) {\n this.runSearch();\n }\n else {\n // reset\n this.autocompleteEntries = this.params.autocompleteEntries;\n this.virtualList.refresh();\n this.checkSetSelectedValue(0);\n }\n this.updateSearchInList();\n }\n runContainsSearch(searchString, searchStrings) {\n let topMatch;\n let topMatchStartsWithSearchString = false;\n const lowerCaseSearchString = searchString.toLocaleLowerCase();\n const allMatches = searchStrings.filter(string => {\n const lowerCaseString = string.toLocaleLowerCase();\n const index = lowerCaseString.indexOf(lowerCaseSearchString);\n const startsWithSearchString = index === 0;\n const isMatch = index >= 0;\n // top match is shortest value that starts with the search string, otherwise shortest value that includes the search string\n if (isMatch && (!topMatch ||\n (!topMatchStartsWithSearchString && startsWithSearchString) ||\n (topMatchStartsWithSearchString === startsWithSearchString && string.length < topMatch.length))) {\n topMatch = string;\n topMatchStartsWithSearchString = startsWithSearchString;\n }\n return isMatch;\n });\n if (!topMatch && allMatches.length) {\n topMatch = allMatches[0];\n }\n return { topMatch, allMatches };\n }\n runSearch() {\n var _a, _b;\n const { autocompleteEntries } = this.params;\n const searchStrings = autocompleteEntries.map(v => { var _a; return (_a = v.displayValue) !== null && _a !== void 0 ? _a : v.key; });\n let matchingStrings;\n let topSuggestion;\n if (this.params.useFuzzySearch) {\n matchingStrings = fuzzySuggestions(this.searchString, searchStrings, true);\n topSuggestion = matchingStrings.length ? matchingStrings[0] : undefined;\n }\n else {\n const containsMatches = this.runContainsSearch(this.searchString, searchStrings);\n matchingStrings = containsMatches.allMatches;\n topSuggestion = containsMatches.topMatch;\n }\n let filteredEntries = autocompleteEntries.filter(({ key, displayValue }) => matchingStrings.includes(displayValue !== null && displayValue !== void 0 ? displayValue : key));\n if (!filteredEntries.length && this.selectedValue && ((_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.forceLastSelection) === null || _b === void 0 ? void 0 : _b.call(_a, this.selectedValue, this.searchString))) {\n filteredEntries = [this.selectedValue];\n }\n this.autocompleteEntries = filteredEntries;\n this.virtualList.refresh();\n if (!topSuggestion) {\n return;\n }\n const topSuggestionIndex = matchingStrings.indexOf(topSuggestion);\n this.checkSetSelectedValue(topSuggestionIndex);\n }\n updateSearchInList() {\n this.virtualList.forEachRenderedRow((row) => row.setSearchString(this.searchString));\n }\n checkSetSelectedValue(index) {\n if (index >= 0 && index < this.autocompleteEntries.length) {\n this.setSelectedValue(index);\n }\n }\n setSelectedValue(index) {\n const value = this.autocompleteEntries[index];\n if (this.selectedValue === value) {\n return;\n }\n this.selectedValue = value;\n this.virtualList.ensureIndexVisible(index);\n this.virtualList.forEachRenderedRow((cmp, idx) => {\n cmp.updateSelected(index === idx);\n });\n }\n createRowComponent(value) {\n var _a;\n const row = new AgAutocompleteRow();\n this.getContext().createBean(row);\n row.setState((_a = value.displayValue) !== null && _a !== void 0 ? _a : value.key, value === this.selectedValue);\n return row;\n }\n onMouseMove(mouseEvent) {\n const rect = this.virtualList.getGui().getBoundingClientRect();\n const scrollTop = this.virtualList.getScrollTop();\n const mouseY = mouseEvent.clientY - rect.top + scrollTop;\n const row = Math.floor(mouseY / this.virtualList.getRowHeight());\n this.checkSetSelectedValue(row);\n }\n afterGuiAttached() {\n this.virtualList.refresh();\n }\n getSelectedValue() {\n var _a;\n if (!this.autocompleteEntries.length) {\n return null;\n }\n ;\n return (_a = this.selectedValue) !== null && _a !== void 0 ? _a : null;\n }\n}\nAgAutocompleteList.TEMPLATE = `
\n
\n
`;\n__decorate([\n RefSelector('eList')\n], AgAutocompleteList.prototype, \"eList\", void 0);\n__decorate([\n PostConstruct\n], AgAutocompleteList.prototype, \"init\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from \"./component.mjs\";\nimport { RefSelector } from \"./componentAnnotations.mjs\";\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { AgAutocompleteList } from \"./agAutocompleteList.mjs\";\nimport { KeyCode } from \"../constants/keyCode.mjs\";\nimport { makeNull } from \"../utils/generic.mjs\";\nexport class AgAutocomplete extends Component {\n constructor() {\n super(/* html */ `\n
\n \n
`);\n this.isListOpen = false;\n this.lastPosition = 0;\n this.valid = true;\n }\n postConstruct() {\n this.eAutocompleteInput.onValueChange(value => this.onValueChanged(value));\n this.eAutocompleteInput.getInputElement().setAttribute('autocomplete', 'off');\n this.addGuiEventListener('keydown', this.onKeyDown.bind(this));\n this.addGuiEventListener('click', this.updatePositionAndList.bind(this));\n this.addDestroyFunc(() => {\n this.destroyBean(this.autocompleteList);\n });\n this.addGuiEventListener('focusout', () => this.onFocusOut());\n }\n onValueChanged(value) {\n const parsedValue = makeNull(value);\n this.updateValue(parsedValue);\n this.updateAutocompleteList(parsedValue);\n }\n updateValue(value) {\n this.updateLastPosition();\n this.dispatchEvent({\n type: AgAutocomplete.EVENT_VALUE_CHANGED,\n value\n });\n this.validate(value);\n }\n updateAutocompleteList(value) {\n var _a, _b, _c, _d;\n const autocompleteListParams = (_b = (_a = this.listGenerator) === null || _a === void 0 ? void 0 : _a.call(this, value, this.lastPosition)) !== null && _b !== void 0 ? _b : { enabled: false };\n if (!autocompleteListParams.type || autocompleteListParams.type !== ((_c = this.autocompleteListParams) === null || _c === void 0 ? void 0 : _c.type)) {\n if (this.isListOpen) {\n this.closeList();\n }\n }\n this.autocompleteListParams = autocompleteListParams;\n if ((_d = this.autocompleteListParams) === null || _d === void 0 ? void 0 : _d.enabled) {\n if (!this.isListOpen) {\n this.openList();\n }\n const { searchString } = this.autocompleteListParams;\n this.autocompleteList.setSearch(searchString !== null && searchString !== void 0 ? searchString : '');\n }\n else {\n if (this.isListOpen) {\n this.closeList();\n }\n }\n }\n onKeyDown(event) {\n const key = event.key;\n this.updateLastPosition();\n switch (key) {\n case KeyCode.ENTER:\n this.onEnterKeyDown(event);\n break;\n case KeyCode.TAB:\n this.onTabKeyDown(event);\n break;\n case KeyCode.DOWN:\n case KeyCode.UP:\n this.onUpDownKeyDown(event, key);\n break;\n case KeyCode.LEFT:\n case KeyCode.RIGHT:\n case KeyCode.PAGE_HOME:\n case KeyCode.PAGE_END:\n // input position is updated after this is called, so do async\n setTimeout(() => {\n this.updatePositionAndList();\n });\n break;\n case KeyCode.ESCAPE:\n this.onEscapeKeyDown(event);\n break;\n case KeyCode.SPACE:\n if (event.ctrlKey && !this.isListOpen) {\n event.preventDefault();\n this.forceOpenList();\n }\n break;\n }\n }\n confirmSelection() {\n var _a;\n const selectedValue = (_a = this.autocompleteList) === null || _a === void 0 ? void 0 : _a.getSelectedValue();\n if (selectedValue) {\n this.closeList();\n this.dispatchEvent({\n type: AgAutocomplete.EVENT_OPTION_SELECTED,\n value: this.getValue(),\n position: this.lastPosition,\n updateEntry: selectedValue,\n autocompleteType: this.autocompleteListParams.type\n });\n }\n }\n onTabKeyDown(event) {\n if (this.isListOpen) {\n event.preventDefault();\n event.stopPropagation();\n this.confirmSelection();\n }\n }\n onEnterKeyDown(event) {\n event.preventDefault();\n if (this.isListOpen) {\n this.confirmSelection();\n }\n else {\n this.onCompleted();\n }\n }\n onUpDownKeyDown(event, key) {\n var _a;\n event.preventDefault();\n if (!this.isListOpen) {\n this.forceOpenList();\n }\n else {\n (_a = this.autocompleteList) === null || _a === void 0 ? void 0 : _a.onNavigationKeyDown(event, key);\n }\n }\n onEscapeKeyDown(event) {\n if (this.isListOpen) {\n event.preventDefault();\n event.stopPropagation();\n this.closeList();\n this.setCaret(this.lastPosition, true);\n }\n }\n onFocusOut() {\n if (this.isListOpen) {\n this.closeList();\n }\n }\n updatePositionAndList() {\n var _a;\n this.updateLastPosition();\n this.updateAutocompleteList((_a = this.eAutocompleteInput.getValue()) !== null && _a !== void 0 ? _a : null);\n }\n setCaret(position, setFocus) {\n const eDocument = this.gridOptionsService.getDocument();\n if (setFocus && eDocument.activeElement === eDocument.body) {\n // clicking on the list loses focus, so restore\n this.eAutocompleteInput.getFocusableElement().focus();\n }\n this.eAutocompleteInput.getInputElement().setSelectionRange(position, position);\n }\n forceOpenList() {\n this.onValueChanged(this.eAutocompleteInput.getValue());\n }\n updateLastPosition() {\n var _a;\n this.lastPosition = (_a = this.eAutocompleteInput.getInputElement().selectionStart) !== null && _a !== void 0 ? _a : 0;\n }\n validate(value) {\n var _a;\n if (!this.validator) {\n return;\n }\n this.validationMessage = this.validator(value);\n this.eAutocompleteInput.getInputElement().setCustomValidity((_a = this.validationMessage) !== null && _a !== void 0 ? _a : '');\n this.valid = !this.validationMessage;\n this.dispatchEvent({\n type: AgAutocomplete.EVENT_VALID_CHANGED,\n isValid: this.valid,\n validationMessage: this.validationMessage\n });\n }\n openList() {\n this.isListOpen = true;\n // this is unmanaged as it gets destroyed/created each time it is opened\n this.autocompleteList = this.createBean(new AgAutocompleteList({\n autocompleteEntries: this.autocompleteListParams.entries,\n onConfirmed: () => this.confirmSelection(),\n forceLastSelection: this.forceLastSelection\n }));\n const ePopupGui = this.autocompleteList.getGui();\n const positionParams = {\n ePopup: ePopupGui,\n type: 'autocomplete',\n eventSource: this.getGui(),\n position: 'under',\n alignSide: this.gridOptionsService.is('enableRtl') ? 'right' : 'left',\n keepWithinBounds: true\n };\n const addPopupRes = this.popupService.addPopup({\n eChild: ePopupGui,\n anchorToElement: this.getGui(),\n positionCallback: () => this.popupService.positionPopupByComponent(positionParams),\n ariaLabel: this.listAriaLabel\n });\n this.hidePopup = addPopupRes.hideFunc;\n this.autocompleteList.afterGuiAttached();\n }\n closeList() {\n this.isListOpen = false;\n this.hidePopup();\n this.destroyBean(this.autocompleteList);\n this.autocompleteList = null;\n }\n onCompleted() {\n if (this.isListOpen) {\n this.closeList();\n }\n this.dispatchEvent({\n type: AgAutocomplete.EVENT_VALUE_CONFIRMED,\n value: this.getValue(),\n isValid: this.isValid()\n });\n }\n getValue() {\n return makeNull(this.eAutocompleteInput.getValue());\n }\n setInputPlaceholder(placeholder) {\n this.eAutocompleteInput.setInputPlaceholder(placeholder);\n return this;\n }\n setInputAriaLabel(label) {\n this.eAutocompleteInput.setInputAriaLabel(label);\n return this;\n }\n setListAriaLabel(label) {\n this.listAriaLabel = label;\n return this;\n }\n setListGenerator(listGenerator) {\n this.listGenerator = listGenerator;\n return this;\n }\n setValidator(validator) {\n this.validator = validator;\n return this;\n }\n isValid() {\n return this.valid;\n }\n setValue(params) {\n const { value, position, silent, updateListOnlyIfOpen, restoreFocus } = params;\n this.eAutocompleteInput.setValue(value, true);\n this.setCaret(position !== null && position !== void 0 ? position : this.lastPosition, restoreFocus);\n if (!silent) {\n this.updateValue(value);\n }\n if (!updateListOnlyIfOpen || this.isListOpen) {\n this.updateAutocompleteList(value);\n }\n }\n setForceLastSelection(forceLastSelection) {\n this.forceLastSelection = forceLastSelection;\n return this;\n }\n setInputDisabled(disabled) {\n this.eAutocompleteInput.setDisabled(disabled);\n return this;\n }\n}\nAgAutocomplete.EVENT_VALUE_CHANGED = 'eventValueChanged';\nAgAutocomplete.EVENT_VALUE_CONFIRMED = 'eventValueConfirmed';\nAgAutocomplete.EVENT_OPTION_SELECTED = 'eventOptionSelected';\nAgAutocomplete.EVENT_VALID_CHANGED = 'eventValidChanged';\n__decorate([\n Autowired('popupService')\n], AgAutocomplete.prototype, \"popupService\", void 0);\n__decorate([\n RefSelector('eAutocompleteInput')\n], AgAutocomplete.prototype, \"eAutocompleteInput\", void 0);\n__decorate([\n PostConstruct\n], AgAutocomplete.prototype, \"postConstruct\", null);\n","import { includes } from \"./utils/array.mjs\";\nimport { AgPromise } from \"./utils/index.mjs\";\nconst OUTSIDE_ANGULAR_EVENTS = ['mouseover', 'mouseout', 'mouseenter', 'mouseleave', 'mousemove'];\nconst PASSIVE_EVENTS = ['touchstart', 'touchend', 'touchmove', 'touchcancel'];\n/** The base frameworks, eg React & Angular, override this bean with implementations specific to their requirement. */\nexport class VanillaFrameworkOverrides {\n constructor() {\n this.renderingEngine = \"vanilla\";\n this.isOutsideAngular = (eventType) => includes(OUTSIDE_ANGULAR_EVENTS, eventType);\n }\n // for Vanilla JS, we use simple timeout\n setTimeout(action, timeout) {\n window.setTimeout(action, timeout);\n }\n setInterval(action, timeout) {\n return new AgPromise(resolve => {\n resolve(window.setInterval(action, timeout));\n });\n }\n // for Vanilla JS, we just add the event to the element\n addEventListener(element, type, listener, useCapture) {\n const isPassive = includes(PASSIVE_EVENTS, type);\n element.addEventListener(type, listener, { capture: !!useCapture, passive: isPassive });\n }\n // for Vanilla JS, we just execute the listener\n dispatchEvent(eventType, listener, global = false) {\n listener();\n }\n frameworkComponent(name) {\n return null;\n }\n isFrameworkComponent(comp) {\n return false;\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean } from \"./context/context.mjs\";\nimport { BeanStub } from \"./context/beanStub.mjs\";\nimport { missing } from \"./utils/generic.mjs\";\nimport { last } from \"./utils/array.mjs\";\nimport { KeyCode } from './constants/keyCode.mjs';\nlet CellNavigationService = class CellNavigationService extends BeanStub {\n // returns null if no cell to focus on, ie at the end of the grid\n getNextCellToFocus(key, focusedCell, ctrlPressed = false) {\n if (ctrlPressed) {\n return this.getNextCellToFocusWithCtrlPressed(key, focusedCell);\n }\n return this.getNextCellToFocusWithoutCtrlPressed(key, focusedCell);\n }\n getNextCellToFocusWithCtrlPressed(key, focusedCell) {\n const upKey = key === KeyCode.UP;\n const downKey = key === KeyCode.DOWN;\n const leftKey = key === KeyCode.LEFT;\n let column;\n let rowIndex;\n if (upKey || downKey) {\n rowIndex = upKey ? this.paginationProxy.getPageFirstRow() : this.paginationProxy.getPageLastRow();\n column = focusedCell.column;\n }\n else {\n const allColumns = this.columnModel.getAllDisplayedColumns();\n const isRtl = this.gridOptionsService.is('enableRtl');\n rowIndex = focusedCell.rowIndex;\n column = leftKey !== isRtl ? allColumns[0] : last(allColumns);\n }\n return {\n rowIndex,\n rowPinned: null,\n column\n };\n }\n getNextCellToFocusWithoutCtrlPressed(key, focusedCell) {\n // starting with the provided cell, we keep moving until we find a cell we can\n // focus on.\n let pointer = focusedCell;\n let finished = false;\n // finished will be true when either:\n // a) cell found that we can focus on\n // b) run out of cells (ie the method returns null)\n while (!finished) {\n switch (key) {\n case KeyCode.UP:\n pointer = this.getCellAbove(pointer);\n break;\n case KeyCode.DOWN:\n pointer = this.getCellBelow(pointer);\n break;\n case KeyCode.RIGHT:\n if (this.gridOptionsService.is('enableRtl')) {\n pointer = this.getCellToLeft(pointer);\n }\n else {\n pointer = this.getCellToRight(pointer);\n }\n break;\n case KeyCode.LEFT:\n if (this.gridOptionsService.is('enableRtl')) {\n pointer = this.getCellToRight(pointer);\n }\n else {\n pointer = this.getCellToLeft(pointer);\n }\n break;\n default:\n pointer = null;\n console.warn('AG Grid: unknown key for navigation ' + key);\n break;\n }\n if (pointer) {\n finished = this.isCellGoodToFocusOn(pointer);\n }\n else {\n finished = true;\n }\n }\n return pointer;\n }\n isCellGoodToFocusOn(gridCell) {\n const column = gridCell.column;\n let rowNode;\n switch (gridCell.rowPinned) {\n case 'top':\n rowNode = this.pinnedRowModel.getPinnedTopRow(gridCell.rowIndex);\n break;\n case 'bottom':\n rowNode = this.pinnedRowModel.getPinnedBottomRow(gridCell.rowIndex);\n break;\n default:\n rowNode = this.rowModel.getRow(gridCell.rowIndex);\n break;\n }\n if (!rowNode) {\n return false;\n }\n const suppressNavigable = column.isSuppressNavigable(rowNode);\n return !suppressNavigable;\n }\n getCellToLeft(lastCell) {\n if (!lastCell) {\n return null;\n }\n const colToLeft = this.columnModel.getDisplayedColBefore(lastCell.column);\n if (!colToLeft) {\n return null;\n }\n return {\n rowIndex: lastCell.rowIndex,\n column: colToLeft,\n rowPinned: lastCell.rowPinned\n };\n }\n getCellToRight(lastCell) {\n if (!lastCell) {\n return null;\n }\n const colToRight = this.columnModel.getDisplayedColAfter(lastCell.column);\n // if already on right, do nothing\n if (!colToRight) {\n return null;\n }\n return {\n rowIndex: lastCell.rowIndex,\n column: colToRight,\n rowPinned: lastCell.rowPinned\n };\n }\n getRowBelow(rowPosition) {\n // if already on top row, do nothing\n const index = rowPosition.rowIndex;\n const pinned = rowPosition.rowPinned;\n if (this.isLastRowInContainer(rowPosition)) {\n switch (pinned) {\n case 'bottom':\n // never any rows after pinned bottom\n return null;\n case 'top':\n // if on last row of pinned top, then next row is main body (if rows exist),\n // otherwise it's the pinned bottom\n if (this.rowModel.isRowsToRender()) {\n return { rowIndex: this.paginationProxy.getPageFirstRow(), rowPinned: null };\n }\n if (this.pinnedRowModel.isRowsToRender('bottom')) {\n return { rowIndex: 0, rowPinned: 'bottom' };\n }\n return null;\n default:\n // if in the main body, then try pinned bottom, otherwise return nothing\n if (this.pinnedRowModel.isRowsToRender('bottom')) {\n return { rowIndex: 0, rowPinned: 'bottom' };\n }\n return null;\n }\n }\n const rowNode = this.rowModel.getRow(rowPosition.rowIndex);\n const nextStickyPosition = this.getNextStickyPosition(rowNode);\n if (nextStickyPosition) {\n return nextStickyPosition;\n }\n return { rowIndex: index + 1, rowPinned: pinned };\n }\n getNextStickyPosition(rowNode, up) {\n if (!this.gridOptionsService.isGroupRowsSticky() || !rowNode || !rowNode.sticky) {\n return;\n }\n const stickyRowCtrls = [...this.rowRenderer.getStickyTopRowCtrls()].sort((a, b) => a.getRowNode().rowIndex - b.getRowNode().rowIndex);\n const diff = up ? -1 : 1;\n const idx = stickyRowCtrls.findIndex(ctrl => ctrl.getRowNode().rowIndex === rowNode.rowIndex);\n const nextCtrl = stickyRowCtrls[idx + diff];\n if (nextCtrl) {\n return { rowIndex: nextCtrl.getRowNode().rowIndex, rowPinned: null };\n }\n }\n getCellBelow(lastCell) {\n if (!lastCell) {\n return null;\n }\n const rowBelow = this.getRowBelow(lastCell);\n if (rowBelow) {\n return {\n rowIndex: rowBelow.rowIndex,\n column: lastCell.column,\n rowPinned: rowBelow.rowPinned\n };\n }\n return null;\n }\n isLastRowInContainer(rowPosition) {\n const pinned = rowPosition.rowPinned;\n const index = rowPosition.rowIndex;\n if (pinned === 'top') {\n const lastTopIndex = this.pinnedRowModel.getPinnedTopRowData().length - 1;\n return lastTopIndex <= index;\n }\n if (pinned === 'bottom') {\n const lastBottomIndex = this.pinnedRowModel.getPinnedBottomRowData().length - 1;\n return lastBottomIndex <= index;\n }\n const lastBodyIndex = this.paginationProxy.getPageLastRow();\n return lastBodyIndex <= index;\n }\n getRowAbove(rowPosition) {\n // if already on top row, do nothing\n const index = rowPosition.rowIndex;\n const pinned = rowPosition.rowPinned;\n const isFirstRow = pinned ? index === 0 : index === this.paginationProxy.getPageFirstRow();\n // if already on top row, do nothing\n if (isFirstRow) {\n if (pinned === 'top') {\n return null;\n }\n if (!pinned) {\n if (this.pinnedRowModel.isRowsToRender('top')) {\n return this.getLastFloatingTopRow();\n }\n return null;\n }\n // last floating bottom\n if (this.rowModel.isRowsToRender()) {\n return this.getLastBodyCell();\n }\n if (this.pinnedRowModel.isRowsToRender('top')) {\n return this.getLastFloatingTopRow();\n }\n return null;\n }\n const rowNode = this.rowModel.getRow(rowPosition.rowIndex);\n const nextStickyPosition = this.getNextStickyPosition(rowNode, true);\n if (nextStickyPosition) {\n return nextStickyPosition;\n }\n return { rowIndex: index - 1, rowPinned: pinned };\n }\n getCellAbove(lastCell) {\n if (!lastCell) {\n return null;\n }\n const rowAbove = this.getRowAbove({ rowIndex: lastCell.rowIndex, rowPinned: lastCell.rowPinned });\n if (rowAbove) {\n return {\n rowIndex: rowAbove.rowIndex,\n column: lastCell.column,\n rowPinned: rowAbove.rowPinned\n };\n }\n return null;\n }\n getLastBodyCell() {\n const lastBodyRow = this.paginationProxy.getPageLastRow();\n return { rowIndex: lastBodyRow, rowPinned: null };\n }\n getLastFloatingTopRow() {\n const lastFloatingRow = this.pinnedRowModel.getPinnedTopRowData().length - 1;\n return { rowIndex: lastFloatingRow, rowPinned: 'top' };\n }\n getNextTabbedCell(gridCell, backwards) {\n if (backwards) {\n return this.getNextTabbedCellBackwards(gridCell);\n }\n return this.getNextTabbedCellForwards(gridCell);\n }\n getNextTabbedCellForwards(gridCell) {\n const displayedColumns = this.columnModel.getAllDisplayedColumns();\n let newRowIndex = gridCell.rowIndex;\n let newFloating = gridCell.rowPinned;\n // move along to the next cell\n let newColumn = this.columnModel.getDisplayedColAfter(gridCell.column);\n // check if end of the row, and if so, go forward a row\n if (!newColumn) {\n newColumn = displayedColumns[0];\n const rowBelow = this.getRowBelow(gridCell);\n if (missing(rowBelow)) {\n return null;\n }\n // If we are tabbing and there is a paging panel present, tabbing should go\n // to the paging panel instead of loading the next page.\n if (!rowBelow.rowPinned && !this.paginationProxy.isRowInPage(rowBelow)) {\n return null;\n }\n newRowIndex = rowBelow ? rowBelow.rowIndex : null;\n newFloating = rowBelow ? rowBelow.rowPinned : null;\n }\n return { rowIndex: newRowIndex, column: newColumn, rowPinned: newFloating };\n }\n getNextTabbedCellBackwards(gridCell) {\n const displayedColumns = this.columnModel.getAllDisplayedColumns();\n let newRowIndex = gridCell.rowIndex;\n let newFloating = gridCell.rowPinned;\n // move along to the next cell\n let newColumn = this.columnModel.getDisplayedColBefore(gridCell.column);\n // check if end of the row, and if so, go forward a row\n if (!newColumn) {\n newColumn = last(displayedColumns);\n const rowAbove = this.getRowAbove({ rowIndex: gridCell.rowIndex, rowPinned: gridCell.rowPinned });\n if (missing(rowAbove)) {\n return null;\n }\n // If we are tabbing and there is a paging panel present, tabbing should go\n // to the paging panel instead of loading the next page.\n if (!rowAbove.rowPinned && !this.paginationProxy.isRowInPage(rowAbove)) {\n return null;\n }\n newRowIndex = rowAbove ? rowAbove.rowIndex : null;\n newFloating = rowAbove ? rowAbove.rowPinned : null;\n }\n return { rowIndex: newRowIndex, column: newColumn, rowPinned: newFloating };\n }\n};\n__decorate([\n Autowired('columnModel')\n], CellNavigationService.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('rowModel')\n], CellNavigationService.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('rowRenderer')\n], CellNavigationService.prototype, \"rowRenderer\", void 0);\n__decorate([\n Autowired('pinnedRowModel')\n], CellNavigationService.prototype, \"pinnedRowModel\", void 0);\n__decorate([\n Autowired('paginationProxy')\n], CellNavigationService.prototype, \"paginationProxy\", void 0);\nCellNavigationService = __decorate([\n Bean('cellNavigationService')\n], CellNavigationService);\nexport { CellNavigationService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { Events } from \"./events.mjs\";\nimport { Bean } from \"./context/context.mjs\";\nimport { Qualifier } from \"./context/context.mjs\";\nimport { Autowired } from \"./context/context.mjs\";\nimport { PostConstruct } from \"./context/context.mjs\";\nimport { BeanStub } from \"./context/beanStub.mjs\";\nlet AlignedGridsService = class AlignedGridsService extends BeanStub {\n constructor() {\n super(...arguments);\n // flag to mark if we are consuming. to avoid cyclic events (ie other grid firing back to master\n // while processing a master event) we mark this if consuming an event, and if we are, then\n // we don't fire back any events.\n this.consuming = false;\n }\n setBeans(loggerFactory) {\n this.logger = loggerFactory.create('AlignedGridsService');\n }\n init() {\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, this.fireColumnEvent.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, this.fireColumnEvent.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, this.fireColumnEvent.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, this.fireColumnEvent.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_RESIZED, this.fireColumnEvent.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, this.fireScrollEvent.bind(this));\n }\n // common logic across all the fire methods\n fireEvent(callback) {\n // if we are already consuming, then we are acting on an event from a master,\n // so we don't cause a cyclic firing of events\n if (this.consuming) {\n return;\n }\n // iterate through the aligned grids, and pass each aligned grid service to the callback\n const otherGrids = this.gridOptionsService.get('alignedGrids');\n if (otherGrids) {\n otherGrids.forEach((otherGridOptions) => {\n if (otherGridOptions.api) {\n const alignedGridService = otherGridOptions.api.__getAlignedGridService();\n callback(alignedGridService);\n }\n });\n }\n }\n // common logic across all consume methods. very little common logic, however extracting\n // guarantees consistency across the methods.\n onEvent(callback) {\n this.consuming = true;\n callback();\n this.consuming = false;\n }\n fireColumnEvent(event) {\n this.fireEvent(alignedGridsService => {\n alignedGridsService.onColumnEvent(event);\n });\n }\n fireScrollEvent(event) {\n if (event.direction !== 'horizontal') {\n return;\n }\n this.fireEvent(alignedGridsService => {\n alignedGridsService.onScrollEvent(event);\n });\n }\n onScrollEvent(event) {\n this.onEvent(() => {\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n gridBodyCon.getScrollFeature().setHorizontalScrollPosition(event.left, true);\n });\n }\n getMasterColumns(event) {\n const result = [];\n if (event.columns) {\n event.columns.forEach((column) => {\n result.push(column);\n });\n }\n else if (event.column) {\n result.push(event.column);\n }\n return result;\n }\n getColumnIds(event) {\n const result = [];\n if (event.columns) {\n event.columns.forEach(column => {\n result.push(column.getColId());\n });\n }\n else if (event.column) {\n result.push(event.column.getColId());\n }\n return result;\n }\n onColumnEvent(event) {\n this.onEvent(() => {\n switch (event.type) {\n case Events.EVENT_COLUMN_MOVED:\n case Events.EVENT_COLUMN_VISIBLE:\n case Events.EVENT_COLUMN_PINNED:\n case Events.EVENT_COLUMN_RESIZED:\n const colEvent = event;\n this.processColumnEvent(colEvent);\n break;\n case Events.EVENT_COLUMN_GROUP_OPENED:\n const groupOpenedEvent = event;\n this.processGroupOpenedEvent(groupOpenedEvent);\n break;\n case Events.EVENT_COLUMN_PIVOT_CHANGED:\n // we cannot support pivoting with aligned grids as the columns will be out of sync as the\n // grids will have columns created based on the row data of the grid.\n console.warn('AG Grid: pivoting is not supported with aligned grids. ' +\n 'You can only use one of these features at a time in a grid.');\n break;\n }\n });\n }\n processGroupOpenedEvent(groupOpenedEvent) {\n // likewise for column group\n const masterColumnGroup = groupOpenedEvent.columnGroup;\n let otherColumnGroup = null;\n if (masterColumnGroup) {\n const groupId = masterColumnGroup.getGroupId();\n otherColumnGroup = this.columnModel.getProvidedColumnGroup(groupId);\n }\n if (masterColumnGroup && !otherColumnGroup) {\n return;\n }\n this.logger.log('onColumnEvent-> processing ' + groupOpenedEvent + ' expanded = ' + masterColumnGroup.isExpanded());\n this.columnModel.setColumnGroupOpened(otherColumnGroup, masterColumnGroup.isExpanded(), \"alignedGridChanged\");\n }\n processColumnEvent(colEvent) {\n var _a;\n // the column in the event is from the master grid. need to\n // look up the equivalent from this (other) grid\n const masterColumn = colEvent.column;\n let otherColumn = null;\n if (masterColumn) {\n otherColumn = this.columnModel.getPrimaryColumn(masterColumn.getColId());\n }\n // if event was with respect to a master column, that is not present in this\n // grid, then we ignore the event\n if (masterColumn && !otherColumn) {\n return;\n }\n // in time, all the methods below should use the column ids, it's a more generic way\n // of handling columns, and also allows for single or multi column events\n const masterColumns = this.getMasterColumns(colEvent);\n switch (colEvent.type) {\n case Events.EVENT_COLUMN_MOVED:\n // when the user moves columns via applyColumnState, we can't depend on moving specific columns\n // to an index, as there maybe be many indexes columns moved to (as wasn't result of a mouse drag).\n // so only way to be sure is match the order of all columns using Column State.\n {\n const movedEvent = colEvent;\n const srcColState = colEvent.columnApi.getColumnState();\n const destColState = srcColState.map(s => ({ colId: s.colId }));\n this.columnModel.applyColumnState({ state: destColState, applyOrder: true }, \"alignedGridChanged\");\n this.logger.log(`onColumnEvent-> processing ${colEvent.type} toIndex = ${movedEvent.toIndex}`);\n }\n break;\n case Events.EVENT_COLUMN_VISIBLE:\n // when the user changes visibility via applyColumnState, we can't depend on visibility flag in event\n // as there maybe be mix of true/false (as wasn't result of a mouse click to set visiblity).\n // so only way to be sure is match the visibility of all columns using Column State.\n {\n const visibleEvent = colEvent;\n const srcColState = colEvent.columnApi.getColumnState();\n const destColState = srcColState.map(s => ({ colId: s.colId, hide: s.hide }));\n this.columnModel.applyColumnState({ state: destColState }, \"alignedGridChanged\");\n this.logger.log(`onColumnEvent-> processing ${colEvent.type} visible = ${visibleEvent.visible}`);\n }\n break;\n case Events.EVENT_COLUMN_PINNED:\n {\n const pinnedEvent = colEvent;\n const srcColState = colEvent.columnApi.getColumnState();\n const destColState = srcColState.map(s => ({ colId: s.colId, pinned: s.pinned }));\n this.columnModel.applyColumnState({ state: destColState }, \"alignedGridChanged\");\n this.logger.log(`onColumnEvent-> processing ${colEvent.type} pinned = ${pinnedEvent.pinned}`);\n }\n break;\n case Events.EVENT_COLUMN_RESIZED:\n const resizedEvent = colEvent;\n const columnWidths = {};\n masterColumns.forEach((column) => {\n this.logger.log(`onColumnEvent-> processing ${colEvent.type} actualWidth = ${column.getActualWidth()}`);\n columnWidths[column.getId()] = { key: column.getColId(), newWidth: column.getActualWidth() };\n });\n // don't set flex columns width\n (_a = resizedEvent.flexColumns) === null || _a === void 0 ? void 0 : _a.forEach(col => {\n if (columnWidths[col.getId()]) {\n delete columnWidths[col.getId()];\n }\n });\n this.columnModel.setColumnWidths(Object.values(columnWidths), false, resizedEvent.finished, \"alignedGridChanged\");\n break;\n }\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n const isVerticalScrollShowing = gridBodyCon.isVerticalScrollShowing();\n const alignedGrids = this.gridOptionsService.get('alignedGrids');\n if (alignedGrids) {\n alignedGrids.forEach((grid) => {\n if (grid.api) {\n grid.api.setAlwaysShowVerticalScroll(isVerticalScrollShowing);\n }\n });\n }\n }\n};\n__decorate([\n Autowired('columnModel')\n], AlignedGridsService.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], AlignedGridsService.prototype, \"ctrlsService\", void 0);\n__decorate([\n __param(0, Qualifier('loggerFactory'))\n], AlignedGridsService.prototype, \"setBeans\", null);\n__decorate([\n PostConstruct\n], AlignedGridsService.prototype, \"init\", null);\nAlignedGridsService = __decorate([\n Bean('alignedGridsService')\n], AlignedGridsService);\nexport { AlignedGridsService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { Bean } from \"./context/context.mjs\";\nimport { BeanStub } from \"./context/beanStub.mjs\";\nimport { Qualifier } from \"./context/context.mjs\";\nimport { Events } from \"./events.mjs\";\nimport { Autowired } from \"./context/context.mjs\";\nimport { PostConstruct } from \"./context/context.mjs\";\nimport { ChangedPath } from \"./utils/changedPath.mjs\";\nimport { iterateObject } from \"./utils/object.mjs\";\nimport { exists } from \"./utils/generic.mjs\";\nimport { _ } from \"./utils/index.mjs\";\nlet SelectionService = class SelectionService extends BeanStub {\n setBeans(loggerFactory) {\n this.logger = loggerFactory.create('selectionService');\n this.reset();\n }\n init() {\n this.groupSelectsChildren = this.gridOptionsService.is('groupSelectsChildren');\n this.addManagedPropertyListener('groupSelectsChildren', (propChange) => this.groupSelectsChildren = propChange.currentValue);\n this.rowSelection = this.gridOptionsService.get('rowSelection');\n this.addManagedPropertyListener('rowSelection', (propChange) => this.rowSelection = propChange.currentValue);\n this.addManagedListener(this.eventService, Events.EVENT_ROW_SELECTED, this.onRowSelected.bind(this));\n }\n isMultiselect() {\n return this.rowSelection === 'multiple';\n }\n setNodesSelected(params) {\n var _a;\n if (params.nodes.length === 0)\n return 0;\n const { newValue, clearSelection, suppressFinishActions, rangeSelect, event, source = 'api', } = params;\n if (params.nodes.length > 1 && !this.isMultiselect()) {\n console.warn(`AG Grid: cannot multi select while rowSelection='single'`);\n return 0;\n }\n // groupSelectsFiltered only makes sense when group selects children\n const groupSelectsFiltered = this.groupSelectsChildren && (params.groupSelectsFiltered === true);\n // if node is a footer, we don't do selection, just pass the info\n // to the sibling (the parent of the group)\n const nodes = params.nodes.map(node => node.footer ? node.sibling : node);\n if (rangeSelect) {\n if (params.nodes.length > 1) {\n console.warn('AG Grid: cannot range select while selecting multiple rows');\n return 0;\n }\n const lastSelectedNode = this.getLastSelectedNode();\n if (lastSelectedNode) {\n // if node is a footer, we don't do selection, just pass the info\n // to the sibling (the parent of the group)\n const node = nodes[0];\n const newRowClicked = lastSelectedNode !== node;\n if (newRowClicked && this.isMultiselect()) {\n const nodesChanged = this.selectRange(node, lastSelectedNode, params.newValue, source);\n this.setLastSelectedNode(node);\n return nodesChanged;\n }\n }\n }\n let updatedCount = 0;\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n // when groupSelectsFiltered, then this node may end up intermediate despite\n // trying to set it to true / false. this group will be calculated further on\n // down when we call calculatedSelectedForAllGroupNodes(). we need to skip it\n // here, otherwise the updatedCount would include it.\n const skipThisNode = groupSelectsFiltered && node.group;\n if (!skipThisNode) {\n const thisNodeWasSelected = node.selectThisNode(newValue, params.event, source);\n if (thisNodeWasSelected) {\n updatedCount++;\n }\n }\n if (this.groupSelectsChildren && ((_a = node.childrenAfterGroup) === null || _a === void 0 ? void 0 : _a.length)) {\n updatedCount += this.selectChildren(node, newValue, groupSelectsFiltered, source);\n }\n }\n // clear other nodes if not doing multi select\n if (!suppressFinishActions) {\n const clearOtherNodes = newValue && (clearSelection || !this.isMultiselect());\n if (clearOtherNodes) {\n updatedCount += this.clearOtherNodes(nodes[0], source);\n }\n // only if we selected something, then update groups and fire events\n if (updatedCount > 0) {\n this.updateGroupsFromChildrenSelections(source);\n // this is the very end of the 'action node', so we are finished all the updates,\n // include any parent / child changes that this method caused\n const event = {\n type: Events.EVENT_SELECTION_CHANGED,\n source\n };\n this.eventService.dispatchEvent(event);\n }\n // so if user next does shift-select, we know where to start the selection from\n if (newValue) {\n this.setLastSelectedNode(nodes[nodes.length - 1]);\n }\n }\n return updatedCount;\n }\n // selects all rows between this node and the last selected node (or the top if this is the first selection).\n // not to be mixed up with 'cell range selection' where you drag the mouse, this is row range selection, by\n // holding down 'shift'.\n selectRange(fromNode, toNode, value = true, source) {\n const nodesToSelect = this.rowModel.getNodesInRangeForSelection(fromNode, toNode);\n let updatedCount = 0;\n nodesToSelect.forEach(rowNode => {\n if (rowNode.group && this.groupSelectsChildren || (value === false && fromNode === rowNode)) {\n return;\n }\n const nodeWasSelected = rowNode.selectThisNode(value, undefined, source);\n if (nodeWasSelected) {\n updatedCount++;\n }\n });\n this.updateGroupsFromChildrenSelections(source);\n const event = {\n type: Events.EVENT_SELECTION_CHANGED,\n source\n };\n this.eventService.dispatchEvent(event);\n return updatedCount;\n }\n selectChildren(node, newValue, groupSelectsFiltered, source) {\n const children = groupSelectsFiltered ? node.childrenAfterAggFilter : node.childrenAfterGroup;\n if (_.missing(children)) {\n return 0;\n }\n return this.setNodesSelected({\n newValue: newValue,\n clearSelection: false,\n suppressFinishActions: true,\n groupSelectsFiltered,\n source,\n nodes: children,\n });\n }\n setLastSelectedNode(rowNode) {\n this.lastSelectedNode = rowNode;\n }\n getLastSelectedNode() {\n return this.lastSelectedNode;\n }\n getSelectedNodes() {\n const selectedNodes = [];\n iterateObject(this.selectedNodes, (key, rowNode) => {\n if (rowNode) {\n selectedNodes.push(rowNode);\n }\n });\n return selectedNodes;\n }\n getSelectedRows() {\n const selectedRows = [];\n iterateObject(this.selectedNodes, (key, rowNode) => {\n if (rowNode && rowNode.data) {\n selectedRows.push(rowNode.data);\n }\n });\n return selectedRows;\n }\n getSelectionCount() {\n return Object.values(this.selectedNodes).length;\n }\n /**\n * This method is used by the CSRM to remove groups which are being disposed of,\n * events do not need fired in this case\n */\n filterFromSelection(predicate) {\n const newSelectedNodes = {};\n Object.entries(this.selectedNodes).forEach(([key, node]) => {\n const passesPredicate = node && predicate(node);\n if (passesPredicate) {\n newSelectedNodes[key] = node;\n }\n });\n this.selectedNodes = newSelectedNodes;\n }\n // should only be called if groupSelectsChildren=true\n updateGroupsFromChildrenSelections(source, changedPath) {\n // we only do this when group selection state depends on selected children\n if (!this.groupSelectsChildren) {\n return false;\n }\n // also only do it if CSRM (code should never allow this anyway)\n if (this.rowModel.getType() !== 'clientSide') {\n return false;\n }\n const clientSideRowModel = this.rowModel;\n const rootNode = clientSideRowModel.getRootNode();\n if (!changedPath) {\n changedPath = new ChangedPath(true, rootNode);\n changedPath.setInactive();\n }\n let selectionChanged = false;\n changedPath.forEachChangedNodeDepthFirst(rowNode => {\n if (rowNode !== rootNode) {\n const selected = rowNode.calculateSelectedFromChildren();\n selectionChanged = rowNode.selectThisNode(selected === null ? false : selected, undefined, source) || selectionChanged;\n }\n });\n return selectionChanged;\n }\n clearOtherNodes(rowNodeToKeepSelected, source) {\n const groupsToRefresh = {};\n let updatedCount = 0;\n iterateObject(this.selectedNodes, (key, otherRowNode) => {\n if (otherRowNode && otherRowNode.id !== rowNodeToKeepSelected.id) {\n const rowNode = this.selectedNodes[otherRowNode.id];\n updatedCount += rowNode.setSelectedParams({\n newValue: false,\n clearSelection: false,\n suppressFinishActions: true,\n source,\n });\n if (this.groupSelectsChildren && otherRowNode.parent) {\n groupsToRefresh[otherRowNode.parent.id] = otherRowNode.parent;\n }\n }\n });\n iterateObject(groupsToRefresh, (key, group) => {\n const selected = group.calculateSelectedFromChildren();\n group.selectThisNode(selected === null ? false : selected, undefined, source);\n });\n return updatedCount;\n }\n onRowSelected(event) {\n const rowNode = event.node;\n // we do not store the group rows when the groups select children\n if (this.groupSelectsChildren && rowNode.group) {\n return;\n }\n if (rowNode.isSelected()) {\n this.selectedNodes[rowNode.id] = rowNode;\n }\n else {\n delete this.selectedNodes[rowNode.id];\n }\n }\n syncInRowNode(rowNode, oldNode) {\n this.syncInOldRowNode(rowNode, oldNode);\n this.syncInNewRowNode(rowNode);\n }\n // if the id has changed for the node, then this means the rowNode\n // is getting used for a different data item, which breaks\n // our selectedNodes, as the node now is mapped by the old id\n // which is inconsistent. so to keep the old node as selected,\n // we swap in the clone (with the old id and old data). this means\n // the oldNode is effectively a daemon we keep a reference to,\n // so if client calls api.getSelectedNodes(), it gets the daemon\n // in the result. when the client un-selects, the reference to the\n // daemon is removed. the daemon, because it's an oldNode, is not\n // used by the grid for rendering, it's a copy of what the node used\n // to be like before the id was changed.\n syncInOldRowNode(rowNode, oldNode) {\n const oldNodeHasDifferentId = exists(oldNode) && (rowNode.id !== oldNode.id);\n if (oldNodeHasDifferentId && oldNode) {\n const id = oldNode.id;\n const oldNodeSelected = this.selectedNodes[id] == rowNode;\n if (oldNodeSelected) {\n this.selectedNodes[oldNode.id] = oldNode;\n }\n }\n }\n syncInNewRowNode(rowNode) {\n if (exists(this.selectedNodes[rowNode.id])) {\n rowNode.setSelectedInitialValue(true);\n this.selectedNodes[rowNode.id] = rowNode;\n }\n else {\n rowNode.setSelectedInitialValue(false);\n }\n }\n reset() {\n this.logger.log('reset');\n this.selectedNodes = {};\n this.lastSelectedNode = null;\n }\n // returns a list of all nodes at 'best cost' - a feature to be used\n // with groups / trees. if a group has all it's children selected,\n // then the group appears in the result, but not the children.\n // Designed for use with 'children' as the group selection type,\n // where groups don't actually appear in the selection normally.\n getBestCostNodeSelection() {\n if (this.rowModel.getType() !== 'clientSide') {\n // Error logged as part of gridApi as that is only call point for this method.\n return;\n }\n const clientSideRowModel = this.rowModel;\n const topLevelNodes = clientSideRowModel.getTopLevelNodes();\n if (topLevelNodes === null) {\n return;\n }\n const result = [];\n // recursive function, to find the selected nodes\n function traverse(nodes) {\n for (let i = 0, l = nodes.length; i < l; i++) {\n const node = nodes[i];\n if (node.isSelected()) {\n result.push(node);\n }\n else {\n // if not selected, then if it's a group, and the group\n // has children, continue to search for selections\n const maybeGroup = node;\n if (maybeGroup.group && maybeGroup.children) {\n traverse(maybeGroup.children);\n }\n }\n }\n }\n traverse(topLevelNodes);\n return result;\n }\n isEmpty() {\n let count = 0;\n iterateObject(this.selectedNodes, (nodeId, rowNode) => {\n if (rowNode) {\n count++;\n }\n });\n return count === 0;\n }\n deselectAllRowNodes(params) {\n const callback = (rowNode) => rowNode.selectThisNode(false, undefined, source);\n const rowModelClientSide = this.rowModel.getType() === 'clientSide';\n const { source, justFiltered, justCurrentPage } = params;\n if (justCurrentPage || justFiltered) {\n if (!rowModelClientSide) {\n console.error(\"AG Grid: selecting just filtered only works when gridOptions.rowModelType='clientSide'\");\n return;\n }\n this.getNodesToSelect(justFiltered, justCurrentPage).forEach(callback);\n }\n else {\n iterateObject(this.selectedNodes, (id, rowNode) => {\n // remember the reference can be to null, as we never 'delete' from the map\n if (rowNode) {\n callback(rowNode);\n }\n });\n // this clears down the map (whereas above only sets the items in map to 'undefined')\n this.reset();\n }\n // the above does not clean up the parent rows if they are selected\n if (rowModelClientSide && this.groupSelectsChildren) {\n this.updateGroupsFromChildrenSelections(source);\n }\n const event = {\n type: Events.EVENT_SELECTION_CHANGED,\n source\n };\n this.eventService.dispatchEvent(event);\n }\n getSelectAllState(justFiltered, justCurrentPage) {\n let selectedCount = 0;\n let notSelectedCount = 0;\n const callback = (node) => {\n if (this.groupSelectsChildren && node.group) {\n return;\n }\n if (node.isSelected()) {\n selectedCount++;\n }\n else if (!node.selectable) {\n // don't count non-selectable nodes!\n }\n else {\n notSelectedCount++;\n }\n };\n this.getNodesToSelect(justFiltered, justCurrentPage).forEach(callback);\n // if no rows, always have it unselected\n if (selectedCount === 0 && notSelectedCount === 0) {\n return false;\n }\n // if mix of selected and unselected, this is indeterminate\n if (selectedCount > 0 && notSelectedCount > 0) {\n return null;\n }\n // only selected\n return selectedCount > 0;\n }\n /**\n * @param justFiltered whether to just include nodes which have passed the filter\n * @param justCurrentPage whether to just include nodes on the current page\n * @returns all nodes including unselectable nodes which are the target of this selection attempt\n */\n getNodesToSelect(justFiltered = false, justCurrentPage = false) {\n if (this.rowModel.getType() !== 'clientSide') {\n throw new Error(`selectAll only available when rowModelType='clientSide', ie not ${this.rowModel.getType()}`);\n }\n const nodes = [];\n if (justCurrentPage) {\n this.paginationProxy.forEachNodeOnPage((node) => {\n if (!node.group) {\n nodes.push(node);\n return;\n }\n if (!node.expanded) {\n // even with groupSelectsChildren, do this recursively as only the filtered children\n // are considered as the current page\n const recursivelyAddChildren = (child) => {\n var _a;\n nodes.push(child);\n if ((_a = child.childrenAfterFilter) === null || _a === void 0 ? void 0 : _a.length) {\n child.childrenAfterFilter.forEach(recursivelyAddChildren);\n }\n };\n recursivelyAddChildren(node);\n return;\n }\n // if the group node is expanded, the pagination proxy will include the visible nodes to select\n if (!this.groupSelectsChildren) {\n nodes.push(node);\n }\n });\n return nodes;\n }\n const clientSideRowModel = this.rowModel;\n if (justFiltered) {\n clientSideRowModel.forEachNodeAfterFilter(node => {\n nodes.push(node);\n });\n return nodes;\n }\n clientSideRowModel.forEachNode(node => {\n nodes.push(node);\n });\n return nodes;\n }\n selectAllRowNodes(params) {\n if (this.rowModel.getType() !== 'clientSide') {\n throw new Error(`selectAll only available when rowModelType='clientSide', ie not ${this.rowModel.getType()}`);\n }\n const { source, justFiltered, justCurrentPage } = params;\n const callback = (rowNode) => rowNode.selectThisNode(true, undefined, source);\n this.getNodesToSelect(justFiltered, justCurrentPage).forEach(callback);\n // the above does not clean up the parent rows if they are selected\n if (this.rowModel.getType() === 'clientSide' && this.groupSelectsChildren) {\n this.updateGroupsFromChildrenSelections(source);\n }\n const event = {\n type: Events.EVENT_SELECTION_CHANGED,\n source\n };\n this.eventService.dispatchEvent(event);\n }\n // Used by SSRM\n getServerSideSelectionState() {\n return null;\n }\n setServerSideSelectionState(state) { }\n};\n__decorate([\n Autowired('rowModel')\n], SelectionService.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('paginationProxy')\n], SelectionService.prototype, \"paginationProxy\", void 0);\n__decorate([\n __param(0, Qualifier('loggerFactory'))\n], SelectionService.prototype, \"setBeans\", null);\n__decorate([\n PostConstruct\n], SelectionService.prototype, \"init\", null);\nSelectionService = __decorate([\n Bean('selectionService')\n], SelectionService);\nexport { SelectionService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, PreDestroy } from \"../context/context.mjs\";\nimport { _ } from \"../utils/index.mjs\";\nimport { logDeprecation } from \"../gridOptionsValidator.mjs\";\nlet ColumnApi = class ColumnApi {\n /**\n * Gets the grid to size the columns to the specified width in pixels, e.g. `sizeColumnsToFit(900)`.\n * To have the grid fit the columns to the grid's width, use the Grid API `gridApi.sizeColumnsToFit()` instead.\n * If inferring cell data types with custom column types and row data is provided asynchronously,\n * the column sizing will happen asynchronously when row data is added.\n * To always perform this synchronously, set `cellDataType = false` on the default column definition.\n */\n sizeColumnsToFit(gridWidth) {\n // AG-3403 validate that gridWidth is provided because this method has the same name as\n // a method on the grid API that takes no arguments, and it's easy to confuse the two\n if (typeof gridWidth === \"undefined\") {\n console.error('AG Grid: missing parameter to columnApi.sizeColumnsToFit(gridWidth)');\n }\n this.columnModel.sizeColumnsToFit(gridWidth, 'api');\n }\n /** Call this if you want to open or close a column group. */\n setColumnGroupOpened(group, newValue) { this.columnModel.setColumnGroupOpened(group, newValue, 'api'); }\n /** Returns the column group with the given name. */\n getColumnGroup(name, instanceId) { return this.columnModel.getColumnGroup(name, instanceId); }\n /** Returns the provided column group with the given name. */\n getProvidedColumnGroup(name) { return this.columnModel.getProvidedColumnGroup(name); }\n /** Returns the display name for a column. Useful if you are doing your own header rendering and want the grid to work out if `headerValueGetter` is used, or if you are doing your own column management GUI, to know what to show as the column name. */\n getDisplayNameForColumn(column, location) { return this.columnModel.getDisplayNameForColumn(column, location) || ''; }\n /** Returns the display name for a column group (when grouping columns). */\n getDisplayNameForColumnGroup(columnGroup, location) { return this.columnModel.getDisplayNameForColumnGroup(columnGroup, location) || ''; }\n /** Returns the column with the given `colKey`, which can either be the `colId` (a string) or the `colDef` (an object). */\n getColumn(key) { return this.columnModel.getPrimaryColumn(key); }\n /** Returns all the columns, regardless of visible or not. */\n getColumns() { return this.columnModel.getAllPrimaryColumns(); }\n /** Applies the state of the columns from a previous state. Returns `false` if one or more columns could not be found. */\n applyColumnState(params) { return this.columnModel.applyColumnState(params, 'api'); }\n /** Gets the state of the columns. Typically used when saving column state. */\n getColumnState() { return this.columnModel.getColumnState(); }\n /** Sets the state back to match the originally provided column definitions. */\n resetColumnState() { this.columnModel.resetColumnState('api'); }\n /** Gets the state of the column groups. Typically used when saving column group state. */\n getColumnGroupState() { return this.columnModel.getColumnGroupState(); }\n /** Sets the state of the column group state from a previous state. */\n setColumnGroupState(stateItems) { this.columnModel.setColumnGroupState(stateItems, 'api'); }\n /** Sets the state back to match the originally provided column definitions. */\n resetColumnGroupState() { this.columnModel.resetColumnGroupState('api'); }\n /** Returns `true` if pinning left or right, otherwise `false`. */\n isPinning() { return this.columnModel.isPinningLeft() || this.columnModel.isPinningRight(); }\n /** Returns `true` if pinning left, otherwise `false`. */\n isPinningLeft() { return this.columnModel.isPinningLeft(); }\n /** Returns `true` if pinning right, otherwise `false`. */\n isPinningRight() { return this.columnModel.isPinningRight(); }\n /** Returns the column to the right of the provided column, taking into consideration open / closed column groups and visible columns. This is useful if you need to know what column is beside yours e.g. if implementing your own cell navigation. */\n getDisplayedColAfter(col) { return this.columnModel.getDisplayedColAfter(col); }\n /** Same as `getVisibleColAfter` except gives column to the left. */\n getDisplayedColBefore(col) { return this.columnModel.getDisplayedColBefore(col); }\n /** Sets the visibility of a column. Key can be the column ID or `Column` object. */\n setColumnVisible(key, visible) { this.columnModel.setColumnVisible(key, visible, 'api'); }\n /** Same as `setColumnVisible`, but provide a list of column keys. */\n setColumnsVisible(keys, visible) { this.columnModel.setColumnsVisible(keys, visible, 'api'); }\n /** Sets the column pinned / unpinned. Key can be the column ID, field, `ColDef` object or `Column` object. */\n setColumnPinned(key, pinned) { this.columnModel.setColumnPinned(key, pinned, 'api'); }\n /** Same as `setColumnPinned`, but provide a list of column keys. */\n setColumnsPinned(keys, pinned) { this.columnModel.setColumnsPinned(keys, pinned, 'api'); }\n /**\n * Returns all the grid columns, same as `getColumns()`, except\n *\n * a) it has the order of the columns that are presented in the grid\n *\n * b) it's after the 'pivot' step, so if pivoting, has the value columns for the pivot.\n */\n getAllGridColumns() { return this.columnModel.getAllGridColumns(); }\n /** Same as `getAllDisplayedColumns` but just for the pinned left portion of the grid. */\n getDisplayedLeftColumns() { return this.columnModel.getDisplayedLeftColumns(); }\n /** Same as `getAllDisplayedColumns` but just for the center portion of the grid. */\n getDisplayedCenterColumns() { return this.columnModel.getDisplayedCenterColumns(); }\n /** Same as `getAllDisplayedColumns` but just for the pinned right portion of the grid. */\n getDisplayedRightColumns() { return this.columnModel.getDisplayedRightColumns(); }\n /** Returns all columns currently displayed (e.g. are visible and if in a group, the group is showing the columns) for the pinned left, centre and pinned right portions of the grid. */\n getAllDisplayedColumns() { return this.columnModel.getAllDisplayedColumns(); }\n /** Same as `getAllGridColumns()`, except only returns rendered columns, i.e. columns that are not within the viewport and therefore not rendered, due to column virtualisation, are not displayed. */\n getAllDisplayedVirtualColumns() { return this.columnModel.getViewportColumns(); }\n /** Moves a column to `toIndex`. The column is first removed, then added at the `toIndex` location, thus index locations will change to the right of the column after the removal. */\n moveColumn(key, toIndex) {\n this.columnModel.moveColumn(key, toIndex, 'api');\n }\n /** Same as `moveColumn` but works on index locations. */\n moveColumnByIndex(fromIndex, toIndex) { this.columnModel.moveColumnByIndex(fromIndex, toIndex, 'api'); }\n /** Same as `moveColumn` but works on list. */\n moveColumns(columnsToMoveKeys, toIndex) { this.columnModel.moveColumns(columnsToMoveKeys, toIndex, 'api'); }\n /** Move the column to a new position in the row grouping order. */\n moveRowGroupColumn(fromIndex, toIndex) { this.columnModel.moveRowGroupColumn(fromIndex, toIndex); }\n /** Sets the agg function for a column. `aggFunc` can be one of the built-in aggregations or a custom aggregation by name or direct function. */\n setColumnAggFunc(key, aggFunc) { this.columnModel.setColumnAggFunc(key, aggFunc); }\n /** Sets the column width on a single column. The finished flag gets included in the resulting event and not used internally by the grid. The finished flag is intended for dragging, where a dragging action will produce many `columnWidth` events, so the consumer of events knows when it receives the last event in a stream. The finished parameter is optional, and defaults to `true`. */\n setColumnWidth(key, newWidth, finished = true, source) {\n this.columnModel.setColumnWidths([{ key, newWidth }], false, finished, source);\n }\n /** Sets the column widths on multiple columns. This method offers better performance than calling `setColumnWidth` multiple times. The finished flag gets included in the resulting event and not used internally by the grid. The finished flag is intended for dragging, where a dragging action will produce many `columnWidth` events, so the consumer of events knows when it receives the last event in a stream. The finished parameter is optional, and defaults to `true`. */\n setColumnWidths(columnWidths, finished = true, source) {\n this.columnModel.setColumnWidths(columnWidths, false, finished, source);\n }\n /** Set the pivot mode. */\n setPivotMode(pivotMode) { this.columnModel.setPivotMode(pivotMode); }\n /** Get the pivot mode. */\n isPivotMode() { return this.columnModel.isPivotMode(); }\n /** Returns the pivot result column for the given `pivotKeys` and `valueColId`. Useful to then call operations on the pivot column. */\n getPivotResultColumn(pivotKeys, valueColKey) { return this.columnModel.getSecondaryPivotColumn(pivotKeys, valueColKey); }\n /** Set the value columns to the provided list of columns. */\n setValueColumns(colKeys) { this.columnModel.setValueColumns(colKeys, 'api'); }\n /** Get a list of the existing value columns. */\n getValueColumns() { return this.columnModel.getValueColumns(); }\n /** Remove the given column from the existing set of value columns. */\n removeValueColumn(colKey) { this.columnModel.removeValueColumn(colKey, 'api'); }\n /** Like `removeValueColumn` but remove the given list of columns from the existing set of value columns. */\n removeValueColumns(colKeys) { this.columnModel.removeValueColumns(colKeys, 'api'); }\n /** Add the given column to the set of existing value columns. */\n addValueColumn(colKey) { this.columnModel.addValueColumn(colKey, 'api'); }\n /** Like `addValueColumn` but add the given list of columns to the existing set of value columns. */\n addValueColumns(colKeys) { this.columnModel.addValueColumns(colKeys, 'api'); }\n /** Set the row group columns. */\n setRowGroupColumns(colKeys) { this.columnModel.setRowGroupColumns(colKeys, 'api'); }\n /** Remove a column from the row groups. */\n removeRowGroupColumn(colKey) { this.columnModel.removeRowGroupColumn(colKey, 'api'); }\n /** Same as `removeRowGroupColumn` but provide a list of columns. */\n removeRowGroupColumns(colKeys) { this.columnModel.removeRowGroupColumns(colKeys, 'api'); }\n /** Add a column to the row groups. */\n addRowGroupColumn(colKey) { this.columnModel.addRowGroupColumn(colKey, 'api'); }\n /** Same as `addRowGroupColumn` but provide a list of columns. */\n addRowGroupColumns(colKeys) { this.columnModel.addRowGroupColumns(colKeys, 'api'); }\n /** Get row group columns. */\n getRowGroupColumns() { return this.columnModel.getRowGroupColumns(); }\n /** Set the pivot columns. */\n setPivotColumns(colKeys) { this.columnModel.setPivotColumns(colKeys, 'api'); }\n /** Remove a pivot column. */\n removePivotColumn(colKey) { this.columnModel.removePivotColumn(colKey, 'api'); }\n /** Same as `removePivotColumn` but provide a list of columns. */\n removePivotColumns(colKeys) { this.columnModel.removePivotColumns(colKeys, 'api'); }\n /** Add a pivot column. */\n addPivotColumn(colKey) { this.columnModel.addPivotColumn(colKey, 'api'); }\n /** Same as `addPivotColumn` but provide a list of columns. */\n addPivotColumns(colKeys) { this.columnModel.addPivotColumns(colKeys, 'api'); }\n /** Get the pivot columns. */\n getPivotColumns() { return this.columnModel.getPivotColumns(); }\n /** Same as `getAllDisplayedColumnGroups` but just for the pinned left portion of the grid. */\n getLeftDisplayedColumnGroups() { return this.columnModel.getDisplayedTreeLeft(); }\n /** Same as `getAllDisplayedColumnGroups` but just for the center portion of the grid. */\n getCenterDisplayedColumnGroups() { return this.columnModel.getDisplayedTreeCentre(); }\n /** Same as `getAllDisplayedColumnGroups` but just for the pinned right portion of the grid. */\n getRightDisplayedColumnGroups() { return this.columnModel.getDisplayedTreeRight(); }\n /** Returns all 'root' column headers. If you are not grouping columns, these return the columns. If you are grouping, these return the top level groups - you can navigate down through each one to get the other lower level headers and finally the columns at the bottom. */\n getAllDisplayedColumnGroups() { return this.columnModel.getAllDisplayedTrees(); }\n /**\n * Auto-sizes a column based on its contents. If inferring cell data types with custom column types and row data is provided asynchronously,\n * the column sizing will happen asynchronously when row data is added. To always perform this synchronously,\n * set `cellDataType = false` on the default column definition.\n */\n autoSizeColumn(key, skipHeader) { return this.columnModel.autoSizeColumn(key, skipHeader, 'api'); }\n /**\n * Same as `autoSizeColumn`, but provide a list of column keys. If inferring cell data types with custom column types\n * and row data is provided asynchronously, the column sizing will happen asynchronously when row data is added.\n * To always perform this synchronously, set `cellDataType = false` on the default column definition.\n */\n autoSizeColumns(keys, skipHeader) {\n this.columnModel.autoSizeColumns({ columns: keys, skipHeader: skipHeader });\n }\n /**\n * Calls `autoSizeColumns` on all displayed columns. If inferring cell data types with custom column types\n * and row data is provided asynchronously, the column sizing will happen asynchronously when row data is added.\n * To always perform this synchronously, set `cellDataType = false` on the default column definition.\n */\n autoSizeAllColumns(skipHeader) { this.columnModel.autoSizeAllColumns(skipHeader, 'api'); }\n /** Set the pivot result columns. */\n setPivotResultColumns(colDefs) { this.columnModel.setSecondaryColumns(colDefs, 'api'); }\n /** Returns the grid's pivot result columns. */\n getPivotResultColumns() { return this.columnModel.getSecondaryColumns(); }\n cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid() {\n // some users were raising support issues with regards memory leaks. the problem was the customers applications\n // were keeping references to the API. trying to educate them all would be difficult, easier to just remove\n // all references in the API so at least the core grid can be garbage collected.\n //\n // wait about 100ms before clearing down the references, in case user has some cleanup to do,\n // and needs to deference the API first\n setTimeout(_.removeAllReferences.bind(window, this, 'Column API'), 100);\n }\n /** @deprecated v28 Use `getColumns` instead */\n getAllColumns() {\n logDeprecation('28.0', 'getAllColumns', 'getColumns');\n return this.getColumns();\n }\n /** @deprecated v28 Use `getColumns` instead. */\n getPrimaryColumns() {\n logDeprecation('28.0', 'getPrimaryColumns', 'getColumns');\n return this.getColumns();\n }\n /** @deprecated v28 Use `getPivotResultColumns` instead. */\n getSecondaryColumns() {\n logDeprecation('28.0', 'getSecondaryColumns', 'getPivotResultColumns');\n return this.getPivotResultColumns();\n }\n /** @deprecated v28 Use `setPivotResultColumns` instead. */\n setSecondaryColumns(colDefs) {\n logDeprecation('28.0', 'setSecondaryColumns', 'setPivotResultColumns');\n this.setPivotResultColumns(colDefs);\n }\n /** @deprecated v28 Use `getPivotResultColumn` instead */\n getSecondaryPivotColumn(pivotKeys, valueColKey) {\n logDeprecation('28.0', 'getSecondaryPivotColumn', 'getPivotResultColumn');\n return this.getPivotResultColumn(pivotKeys, valueColKey);\n }\n};\n__decorate([\n Autowired('columnModel')\n], ColumnApi.prototype, \"columnModel\", void 0);\n__decorate([\n PreDestroy\n], ColumnApi.prototype, \"cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid\", null);\nColumnApi = __decorate([\n Bean('columnApi')\n], ColumnApi);\nexport { ColumnApi };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { Events } from \"../events.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { getValueUsingField } from \"../utils/object.mjs\";\nimport { missing, exists } from \"../utils/generic.mjs\";\nimport { doOnce } from \"../utils/function.mjs\";\nlet ValueService = class ValueService extends BeanStub {\n constructor() {\n super(...arguments);\n this.initialised = false;\n this.isSsrm = false;\n }\n init() {\n this.isSsrm = this.gridOptionsService.isRowModelType('serverSide');\n this.cellExpressions = this.gridOptionsService.is('enableCellExpressions');\n this.isTreeData = this.gridOptionsService.is('treeData');\n this.initialised = true;\n // We listen to our own event and use it to call the columnSpecific callback,\n // this way the handler calls are correctly interleaved with other global events\n this.eventService.addEventListener(Events.EVENT_CELL_VALUE_CHANGED, (event) => this.callColumnCellValueChangedHandler(event), this.gridOptionsService.useAsyncEvents());\n this.addManagedPropertyListener('treeData', (propChange) => this.isTreeData = propChange.currentValue);\n }\n getValue(column, rowNode, forFilter = false, ignoreAggData = false) {\n // hack - the grid is getting refreshed before this bean gets initialised, race condition.\n // really should have a way so they get initialised in the right order???\n if (!this.initialised) {\n this.init();\n }\n if (!rowNode) {\n return;\n }\n // pull these out to make code below easier to read\n const colDef = column.getColDef();\n const field = colDef.field;\n const colId = column.getColId();\n const data = rowNode.data;\n let result;\n // if there is a value getter, this gets precedence over a field\n const groupDataExists = rowNode.groupData && rowNode.groupData[colId] !== undefined;\n const aggDataExists = !ignoreAggData && rowNode.aggData && rowNode.aggData[colId] !== undefined;\n // SSRM agg data comes from the data attribute, so ignore that instead\n const ignoreSsrmAggData = this.isSsrm && ignoreAggData && !!column.getColDef().aggFunc;\n const ssrmFooterGroupCol = this.isSsrm && rowNode.footer && rowNode.field && (column.getColDef().showRowGroup === true || column.getColDef().showRowGroup === rowNode.field);\n if (forFilter && colDef.filterValueGetter) {\n result = this.executeFilterValueGetter(colDef.filterValueGetter, data, column, rowNode);\n }\n else if (this.isTreeData && aggDataExists) {\n result = rowNode.aggData[colId];\n }\n else if (this.isTreeData && colDef.valueGetter) {\n result = this.executeValueGetter(colDef.valueGetter, data, column, rowNode);\n }\n else if (this.isTreeData && (field && data)) {\n result = getValueUsingField(data, field, column.isFieldContainsDots());\n }\n else if (groupDataExists) {\n result = rowNode.groupData[colId];\n }\n else if (aggDataExists) {\n result = rowNode.aggData[colId];\n }\n else if (colDef.valueGetter) {\n result = this.executeValueGetter(colDef.valueGetter, data, column, rowNode);\n }\n else if (ssrmFooterGroupCol) {\n // this is for group footers in SSRM, as the SSRM row won't have groupData, need to extract\n // the group value from the data using the row field\n result = getValueUsingField(data, rowNode.field, column.isFieldContainsDots());\n }\n else if (field && data && !ignoreSsrmAggData) {\n result = getValueUsingField(data, field, column.isFieldContainsDots());\n }\n // the result could be an expression itself, if we are allowing cell values to be expressions\n if (this.cellExpressions && (typeof result === 'string') && result.indexOf('=') === 0) {\n const cellValueGetter = result.substring(1);\n result = this.executeValueGetter(cellValueGetter, data, column, rowNode);\n }\n if (result == null) {\n const openedGroup = this.getOpenedGroup(rowNode, column);\n if (openedGroup != null) {\n return openedGroup;\n }\n }\n return result;\n }\n getOpenedGroup(rowNode, column) {\n if (!this.gridOptionsService.is('showOpenedGroup')) {\n return;\n }\n const colDef = column.getColDef();\n if (!colDef.showRowGroup) {\n return;\n }\n const showRowGroup = column.getColDef().showRowGroup;\n let pointer = rowNode.parent;\n while (pointer != null) {\n if (pointer.rowGroupColumn && (showRowGroup === true || showRowGroup === pointer.rowGroupColumn.getColId())) {\n return pointer.key;\n }\n pointer = pointer.parent;\n }\n return undefined;\n }\n /**\n * Sets the value of a GridCell\n * @param rowNode The `RowNode` to be updated\n * @param colKey The `Column` to be updated\n * @param newValue The new value to be set\n * @param eventSource The event source\n * @returns `True` if the value has been updated, otherwise`False`.\n */\n setValue(rowNode, colKey, newValue, eventSource) {\n const column = this.columnModel.getPrimaryColumn(colKey);\n if (!rowNode || !column) {\n return false;\n }\n // this will only happen if user is trying to paste into a group row, which doesn't make sense\n // the user should not be trying to paste into group rows\n if (missing(rowNode.data)) {\n rowNode.data = {};\n }\n const { field, valueSetter } = column.getColDef();\n if (missing(field) && missing(valueSetter)) {\n console.warn(`AG Grid: you need either field or valueSetter set on colDef for editing to work`);\n return false;\n }\n if (!this.dataTypeService.checkType(column, newValue)) {\n console.warn(`AG Grid: Data type of the new value does not match the cell data type of the column`);\n return false;\n }\n const params = {\n node: rowNode,\n data: rowNode.data,\n oldValue: this.getValue(column, rowNode),\n newValue: newValue,\n colDef: column.getColDef(),\n column: column,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context\n };\n params.newValue = newValue;\n let valueWasDifferent;\n if (exists(valueSetter)) {\n if (typeof valueSetter === 'function') {\n valueWasDifferent = valueSetter(params);\n }\n else {\n valueWasDifferent = this.expressionService.evaluate(valueSetter, params);\n }\n }\n else {\n valueWasDifferent = this.setValueUsingField(rowNode.data, field, newValue, column.isFieldContainsDots());\n }\n // in case user forgot to return something (possible if they are not using TypeScript\n // and just forgot we default the return value to true, so we always refresh.\n if (valueWasDifferent === undefined) {\n valueWasDifferent = true;\n }\n // if no change to the value, then no need to do the updating, or notifying via events.\n // otherwise the user could be tabbing around the grid, and cellValueChange would get called\n // all the time.\n if (!valueWasDifferent) {\n return false;\n }\n // reset quick filter on this row\n rowNode.resetQuickFilterAggregateText();\n this.valueCache.onDataChanged();\n params.newValue = this.getValue(column, rowNode);\n const event = {\n type: Events.EVENT_CELL_VALUE_CHANGED,\n event: null,\n rowIndex: rowNode.rowIndex,\n rowPinned: rowNode.rowPinned,\n column: params.column,\n api: params.api,\n columnApi: params.columnApi,\n colDef: params.colDef,\n context: params.context,\n data: rowNode.data,\n node: rowNode,\n oldValue: params.oldValue,\n newValue: params.newValue,\n value: params.newValue,\n source: eventSource\n };\n this.eventService.dispatchEvent(event);\n return true;\n }\n callColumnCellValueChangedHandler(event) {\n const onCellValueChanged = event.colDef.onCellValueChanged;\n if (typeof onCellValueChanged === 'function') {\n onCellValueChanged({\n node: event.node,\n data: event.data,\n oldValue: event.oldValue,\n newValue: event.newValue,\n colDef: event.colDef,\n column: event.column,\n api: event.api,\n columnApi: event.columnApi,\n context: event.context\n });\n }\n }\n setValueUsingField(data, field, newValue, isFieldContainsDots) {\n if (!field) {\n return false;\n }\n // if no '.', then it's not a deep value\n let valuesAreSame = false;\n if (!isFieldContainsDots) {\n // soft comparison to match strings and numbers\n valuesAreSame = data[field] == newValue;\n if (!valuesAreSame) {\n data[field] = newValue;\n }\n }\n else {\n // otherwise it is a deep value, so need to dig for it\n const fieldPieces = field.split('.');\n let currentObject = data;\n while (fieldPieces.length > 0 && currentObject) {\n const fieldPiece = fieldPieces.shift();\n if (fieldPieces.length === 0) {\n // soft comparison to match strings and numbers\n valuesAreSame = currentObject[fieldPiece] == newValue;\n if (!valuesAreSame) {\n currentObject[fieldPiece] = newValue;\n }\n }\n else {\n currentObject = currentObject[fieldPiece];\n }\n }\n }\n return !valuesAreSame;\n }\n executeFilterValueGetter(valueGetter, data, column, rowNode) {\n const params = {\n data: data,\n node: rowNode,\n column: column,\n colDef: column.getColDef(),\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context,\n getValue: this.getValueCallback.bind(this, rowNode)\n };\n if (typeof valueGetter === 'function') {\n return valueGetter(params);\n }\n return this.expressionService.evaluate(valueGetter, params);\n }\n executeValueGetter(valueGetter, data, column, rowNode) {\n const colId = column.getColId();\n // if inside the same turn, just return back the value we got last time\n const valueFromCache = this.valueCache.getValue(rowNode, colId);\n if (valueFromCache !== undefined) {\n return valueFromCache;\n }\n const params = {\n data: data,\n node: rowNode,\n column: column,\n colDef: column.getColDef(),\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context,\n getValue: this.getValueCallback.bind(this, rowNode)\n };\n let result;\n if (typeof valueGetter === 'function') {\n result = valueGetter(params);\n }\n else {\n result = this.expressionService.evaluate(valueGetter, params);\n }\n // if a turn is active, store the value in case the grid asks for it again\n this.valueCache.setValue(rowNode, colId, result);\n return result;\n }\n getValueCallback(node, field) {\n const otherColumn = this.columnModel.getPrimaryColumn(field);\n if (otherColumn) {\n return this.getValue(otherColumn, node);\n }\n return null;\n }\n // used by row grouping and pivot, to get key for a row. col can be a pivot col or a row grouping col\n getKeyForNode(col, rowNode) {\n const value = this.getValue(col, rowNode);\n const keyCreator = col.getColDef().keyCreator;\n let result = value;\n if (keyCreator) {\n const keyParams = {\n value: value,\n colDef: col.getColDef(),\n column: col,\n node: rowNode,\n data: rowNode.data,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context\n };\n result = keyCreator(keyParams);\n }\n // if already a string, or missing, just return it\n if (typeof result === 'string' || result == null) {\n return result;\n }\n result = String(result);\n if (result === '[object Object]') {\n doOnce(() => {\n console.warn('AG Grid: a column you are grouping or pivoting by has objects as values. If you want to group by complex objects then either a) use a colDef.keyCreator (se AG Grid docs) or b) to toString() on the object to return a key');\n }, 'getKeyForNode - warn about [object,object]');\n }\n return result;\n }\n};\n__decorate([\n Autowired('expressionService')\n], ValueService.prototype, \"expressionService\", void 0);\n__decorate([\n Autowired('columnModel')\n], ValueService.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('valueCache')\n], ValueService.prototype, \"valueCache\", void 0);\n__decorate([\n Autowired('dataTypeService')\n], ValueService.prototype, \"dataTypeService\", void 0);\n__decorate([\n PostConstruct\n], ValueService.prototype, \"init\", null);\nValueService = __decorate([\n Bean('valueService')\n], ValueService);\nexport { ValueService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { Bean } from \"../context/context.mjs\";\nimport { Qualifier } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nlet ExpressionService = class ExpressionService extends BeanStub {\n constructor() {\n super(...arguments);\n this.expressionToFunctionCache = {};\n }\n setBeans(loggerFactory) {\n this.logger = loggerFactory.create('ExpressionService');\n }\n evaluate(expression, params) {\n if (typeof expression === 'string') {\n // valueGetter is an expression, so execute the expression\n return this.evaluateExpression(expression, params);\n }\n else {\n console.error('AG Grid: value should be either a string or a function', expression);\n }\n }\n evaluateExpression(expression, params) {\n try {\n const javaScriptFunction = this.createExpressionFunction(expression);\n // the params don't have all these values, rather we add every possible\n // value a params can have, which makes whatever is in the params available.\n const result = javaScriptFunction(params.value, params.context, params.oldValue, params.newValue, params.value, params.node, params.data, params.colDef, params.rowIndex, params.api, params.columnApi, params.getValue, params.column, params.columnGroup);\n return result;\n }\n catch (e) {\n // the expression failed, which can happen, as it's the client that\n // provides the expression. so print a nice message\n // tslint:disable-next-line\n console.log('Processing of the expression failed');\n // tslint:disable-next-line\n console.log('Expression = ' + expression);\n // tslint:disable-next-line\n console.log('Params =', params);\n // tslint:disable-next-line\n console.log('Exception = ' + e);\n return null;\n }\n }\n createExpressionFunction(expression) {\n // check cache first\n if (this.expressionToFunctionCache[expression]) {\n return this.expressionToFunctionCache[expression];\n }\n // if not found in cache, return the function\n const functionBody = this.createFunctionBody(expression);\n const theFunction = new Function('x, ctx, oldValue, newValue, value, node, data, colDef, rowIndex, api, columnApi, getValue, column, columnGroup', functionBody);\n // store in cache\n this.expressionToFunctionCache[expression] = theFunction;\n return theFunction;\n }\n createFunctionBody(expression) {\n // if the expression has the 'return' word in it, then use as is,\n // if not, then wrap it with return and ';' to make a function\n if (expression.indexOf('return') >= 0) {\n return expression;\n }\n else {\n return 'return ' + expression + ';';\n }\n }\n};\n__decorate([\n __param(0, Qualifier('loggerFactory'))\n], ExpressionService.prototype, \"setBeans\", null);\nExpressionService = __decorate([\n Bean('expressionService')\n], ExpressionService);\nexport { ExpressionService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean } from \"./context/context.mjs\";\nimport { BeanStub } from \"./context/beanStub.mjs\";\nlet TemplateService = class TemplateService extends BeanStub {\n constructor() {\n super(...arguments);\n this.templateCache = {};\n this.waitingCallbacks = {};\n }\n // returns the template if it is loaded, or null if it is not loaded\n // but will call the callback when it is loaded\n getTemplate(url, callback) {\n const templateFromCache = this.templateCache[url];\n if (templateFromCache) {\n return templateFromCache;\n }\n let callbackList = this.waitingCallbacks[url];\n const that = this;\n if (!callbackList) {\n // first time this was called, so need a new list for callbacks\n callbackList = [];\n this.waitingCallbacks[url] = callbackList;\n // and also need to do the http request\n const client = new XMLHttpRequest();\n client.onload = function () {\n that.handleHttpResult(this, url);\n };\n client.open(\"GET\", url);\n client.send();\n }\n // add this callback\n if (callback) {\n callbackList.push(callback);\n }\n // caller needs to wait for template to load, so return null\n return null;\n }\n handleHttpResult(httpResult, url) {\n if (httpResult.status !== 200 || httpResult.response === null) {\n console.warn(`AG Grid: Unable to get template error ${httpResult.status} - ${url}`);\n return;\n }\n // response success, so process it\n // in IE9 the response is in - responseText\n this.templateCache[url] = httpResult.response || httpResult.responseText;\n // inform all listeners that this is now in the cache\n const callbacks = this.waitingCallbacks[url];\n for (let i = 0; i < callbacks.length; i++) {\n const callback = callbacks[i];\n // we could pass the callback the response, however we know the client of this code\n // is the cell renderer, and it passes the 'cellRefresh' method in as the callback\n // which doesn't take any parameters.\n callback();\n }\n }\n};\nTemplateService = __decorate([\n Bean('templateService')\n], TemplateService);\nexport { TemplateService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { Bean } from \"./context/context.mjs\";\nimport { Qualifier } from \"./context/context.mjs\";\nimport { BeanStub } from \"./context/beanStub.mjs\";\nlet LoggerFactory = class LoggerFactory extends BeanStub {\n setBeans(gridOptionsService) {\n this.logging = gridOptionsService.is('debug');\n }\n create(name) {\n return new Logger(name, this.isLogging.bind(this));\n }\n isLogging() {\n return this.logging;\n }\n};\n__decorate([\n __param(0, Qualifier('gridOptionsService'))\n], LoggerFactory.prototype, \"setBeans\", null);\nLoggerFactory = __decorate([\n Bean('loggerFactory')\n], LoggerFactory);\nexport { LoggerFactory };\nexport class Logger {\n constructor(name, isLoggingFunc) {\n this.name = name;\n this.isLoggingFunc = isLoggingFunc;\n }\n isLogging() {\n return this.isLoggingFunc();\n }\n log(message) {\n if (this.isLoggingFunc()) {\n // tslint:disable-next-line\n console.log('AG Grid.' + this.name + ': ' + message);\n }\n }\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { ModuleRegistry } from \"../modules/moduleRegistry.mjs\";\nimport { ModuleNames } from \"../modules/moduleNames.mjs\";\nimport { LayoutFeature } from \"../styling/layoutFeature.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { last } from \"../utils/array.mjs\";\nimport { DragAndDropService, DragSourceType } from \"../dragAndDrop/dragAndDropService.mjs\";\nexport class GridCtrl extends BeanStub {\n setComp(view, eGridDiv, eGui) {\n this.view = view;\n this.eGridHostDiv = eGridDiv;\n this.eGui = eGui;\n this.eGui.setAttribute('grid-id', this.context.getGridId());\n // this drop target is just used to see if the drop event is inside the grid\n this.dragAndDropService.addDropTarget({\n getContainer: () => this.eGui,\n isInterestedIn: (type) => type === DragSourceType.HeaderCell || type === DragSourceType.ToolPanel,\n getIconName: () => DragAndDropService.ICON_NOT_ALLOWED,\n });\n this.mouseEventService.stampTopLevelGridCompWithGridInstance(eGridDiv);\n this.createManagedBean(new LayoutFeature(this.view));\n this.addRtlSupport();\n this.addManagedListener(this, Events.EVENT_KEYBOARD_FOCUS, () => {\n this.view.addOrRemoveKeyboardFocusClass(true);\n });\n this.addManagedListener(this, Events.EVENT_MOUSE_FOCUS, () => {\n this.view.addOrRemoveKeyboardFocusClass(false);\n });\n const unsubscribeFromResize = this.resizeObserverService.observeResize(this.eGridHostDiv, this.onGridSizeChanged.bind(this));\n this.addDestroyFunc(() => unsubscribeFromResize());\n this.ctrlsService.registerGridCtrl(this);\n }\n isDetailGrid() {\n var _a;\n const el = this.focusService.findTabbableParent(this.getGui());\n return ((_a = el === null || el === void 0 ? void 0 : el.getAttribute('row-id')) === null || _a === void 0 ? void 0 : _a.startsWith('detail')) || false;\n }\n showDropZones() {\n return ModuleRegistry.__isRegistered(ModuleNames.RowGroupingModule, this.context.getGridId());\n }\n showSideBar() {\n return ModuleRegistry.__isRegistered(ModuleNames.SideBarModule, this.context.getGridId());\n }\n showStatusBar() {\n return ModuleRegistry.__isRegistered(ModuleNames.StatusBarModule, this.context.getGridId());\n }\n showWatermark() {\n return ModuleRegistry.__isRegistered(ModuleNames.EnterpriseCoreModule, this.context.getGridId());\n }\n onGridSizeChanged() {\n const event = {\n type: Events.EVENT_GRID_SIZE_CHANGED,\n clientWidth: this.eGridHostDiv.clientWidth,\n clientHeight: this.eGridHostDiv.clientHeight\n };\n this.eventService.dispatchEvent(event);\n }\n addRtlSupport() {\n const cssClass = this.gridOptionsService.is('enableRtl') ? 'ag-rtl' : 'ag-ltr';\n this.view.setRtlClass(cssClass);\n }\n destroyGridUi() {\n this.view.destroyGridUi();\n }\n getGui() {\n return this.eGui;\n }\n setResizeCursor(on) {\n this.view.setCursor(on ? 'ew-resize' : null);\n }\n disableUserSelect(on) {\n this.view.setUserSelect(on ? 'none' : null);\n }\n focusNextInnerContainer(backwards) {\n const eDocument = this.gridOptionsService.getDocument();\n const focusableContainers = this.view.getFocusableContainers();\n const idxWithFocus = focusableContainers.findIndex(container => container.contains(eDocument.activeElement));\n const nextIdx = idxWithFocus + (backwards ? -1 : 1);\n if (nextIdx <= 0 || nextIdx >= focusableContainers.length) {\n return false;\n }\n return this.focusService.focusInto(focusableContainers[nextIdx]);\n }\n focusInnerElement(fromBottom) {\n const focusableContainers = this.view.getFocusableContainers();\n const allColumns = this.columnModel.getAllDisplayedColumns();\n if (fromBottom) {\n if (focusableContainers.length > 1) {\n return this.focusService.focusInto(last(focusableContainers), true);\n }\n const lastColumn = last(allColumns);\n if (this.focusService.focusGridView(lastColumn, true)) {\n return true;\n }\n }\n if (this.gridOptionsService.getNum('headerHeight') === 0) {\n return this.focusService.focusGridView(allColumns[0]);\n }\n return this.focusService.focusFirstHeader();\n }\n forceFocusOutOfContainer(up = false) {\n this.view.forceFocusOutOfContainer(up);\n }\n}\n__decorate([\n Autowired('focusService')\n], GridCtrl.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('resizeObserverService')\n], GridCtrl.prototype, \"resizeObserverService\", void 0);\n__decorate([\n Autowired('columnModel')\n], GridCtrl.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], GridCtrl.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('mouseEventService')\n], GridCtrl.prototype, \"mouseEventService\", void 0);\n__decorate([\n Autowired('dragAndDropService')\n], GridCtrl.prototype, \"dragAndDropService\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { RefSelector } from \"../widgets/componentAnnotations.mjs\";\nimport { isVisible } from \"../utils/dom.mjs\";\nimport { FocusService } from \"../focusService.mjs\";\nimport { GridCtrl } from \"./gridCtrl.mjs\";\nimport { LayoutCssClasses } from \"../styling/layoutFeature.mjs\";\nimport { TabGuardComp } from \"../widgets/tabGuardComp.mjs\";\nexport class GridComp extends TabGuardComp {\n constructor(eGridDiv) {\n super();\n this.eGridDiv = eGridDiv;\n }\n postConstruct() {\n this.logger = this.loggerFactory.create('GridComp');\n const compProxy = {\n destroyGridUi: () => this.destroyBean(this),\n setRtlClass: (cssClass) => this.addCssClass(cssClass),\n addOrRemoveKeyboardFocusClass: (addOrRemove) => this.addOrRemoveCssClass(FocusService.AG_KEYBOARD_FOCUS, addOrRemove),\n forceFocusOutOfContainer: this.forceFocusOutOfContainer.bind(this),\n updateLayoutClasses: this.updateLayoutClasses.bind(this),\n getFocusableContainers: this.getFocusableContainers.bind(this),\n setUserSelect: value => {\n this.getGui().style.userSelect = value != null ? value : '';\n this.getGui().style.webkitUserSelect = value != null ? value : '';\n },\n setCursor: value => {\n this.getGui().style.cursor = value != null ? value : '';\n }\n };\n this.ctrl = this.createManagedBean(new GridCtrl());\n const template = this.createTemplate();\n this.setTemplate(template);\n this.ctrl.setComp(compProxy, this.eGridDiv, this.getGui());\n this.insertGridIntoDom();\n this.initialiseTabGuard({\n // we want to override the default behaviour to do nothing for onTabKeyDown\n onTabKeyDown: () => undefined,\n focusInnerElement: fromBottom => this.ctrl.focusInnerElement(fromBottom)\n });\n }\n insertGridIntoDom() {\n const eGui = this.getGui();\n this.eGridDiv.appendChild(eGui);\n this.addDestroyFunc(() => {\n this.eGridDiv.removeChild(eGui);\n this.logger.log('Grid removed from DOM');\n });\n }\n updateLayoutClasses(cssClass, params) {\n const eRootWrapperBodyClassList = this.eRootWrapperBody.classList;\n eRootWrapperBodyClassList.toggle(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);\n eRootWrapperBodyClassList.toggle(LayoutCssClasses.NORMAL, params.normal);\n eRootWrapperBodyClassList.toggle(LayoutCssClasses.PRINT, params.print);\n this.addOrRemoveCssClass(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);\n this.addOrRemoveCssClass(LayoutCssClasses.NORMAL, params.normal);\n this.addOrRemoveCssClass(LayoutCssClasses.PRINT, params.print);\n }\n createTemplate() {\n const dropZones = this.ctrl.showDropZones() ? '' : '';\n const sideBar = this.ctrl.showSideBar() ? '' : '';\n const statusBar = this.ctrl.showStatusBar() ? '' : '';\n const watermark = this.ctrl.showWatermark() ? '' : '';\n const template = /* html */ `
\n ${dropZones}\n
\n \n ${sideBar}\n
\n ${statusBar}\n \n ${watermark}\n
`;\n return template;\n }\n getFocusableElement() {\n return this.eRootWrapperBody;\n }\n getFocusableContainers() {\n const focusableContainers = [\n this.gridBodyComp.getGui()\n ];\n if (this.sideBarComp) {\n focusableContainers.push(this.sideBarComp.getGui());\n }\n return focusableContainers.filter(el => isVisible(el));\n }\n}\n__decorate([\n Autowired('loggerFactory')\n], GridComp.prototype, \"loggerFactory\", void 0);\n__decorate([\n RefSelector('gridBody')\n], GridComp.prototype, \"gridBodyComp\", void 0);\n__decorate([\n RefSelector('sideBar')\n], GridComp.prototype, \"sideBarComp\", void 0);\n__decorate([\n RefSelector('rootWrapperBody')\n], GridComp.prototype, \"eRootWrapperBody\", void 0);\n__decorate([\n PostConstruct\n], GridComp.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar SortController_1;\nimport { Autowired, Bean } from \"./context/context.mjs\";\nimport { BeanStub } from \"./context/beanStub.mjs\";\nimport { Events } from \"./events.mjs\";\nlet SortController = SortController_1 = class SortController extends BeanStub {\n progressSort(column, multiSort, source) {\n const nextDirection = this.getNextSortDirection(column);\n this.setSortForColumn(column, nextDirection, multiSort, source);\n }\n setSortForColumn(column, sort, multiSort, source) {\n // auto correct - if sort not legal value, then set it to 'no sort' (which is null)\n if (sort !== 'asc' && sort !== 'desc') {\n sort = null;\n }\n const isColumnsSortingCoupledToGroup = this.gridOptionsService.isColumnsSortingCoupledToGroup();\n let columnsToUpdate = [column];\n if (isColumnsSortingCoupledToGroup) {\n if (column.getColDef().showRowGroup) {\n const rowGroupColumns = this.columnModel.getSourceColumnsForGroupColumn(column);\n const sortableRowGroupColumns = rowGroupColumns === null || rowGroupColumns === void 0 ? void 0 : rowGroupColumns.filter(col => col.getColDef().sortable);\n if (sortableRowGroupColumns) {\n columnsToUpdate = [column, ...sortableRowGroupColumns];\n }\n }\n }\n columnsToUpdate.forEach(col => col.setSort(sort, source));\n const doingMultiSort = (multiSort || this.gridOptionsService.is('alwaysMultiSort')) && !this.gridOptionsService.is('suppressMultiSort');\n // clear sort on all columns except those changed, and update the icons\n if (!doingMultiSort) {\n this.clearSortBarTheseColumns(columnsToUpdate, source);\n }\n // sortIndex used for knowing order of cols when multi-col sort\n this.updateSortIndex(column);\n this.dispatchSortChangedEvents(source);\n }\n updateSortIndex(lastColToChange) {\n const isCoupled = this.gridOptionsService.isColumnsSortingCoupledToGroup();\n const groupParent = this.columnModel.getGroupDisplayColumnForGroup(lastColToChange.getId());\n const lastSortIndexCol = isCoupled ? groupParent || lastColToChange : lastColToChange;\n const allSortedCols = this.getColumnsWithSortingOrdered();\n // reset sort index on everything\n this.columnModel.getPrimaryAndSecondaryAndAutoColumns().forEach(col => col.setSortIndex(null));\n const allSortedColsWithoutChanges = allSortedCols.filter(col => col !== lastSortIndexCol);\n const sortedColsWithIndices = !!lastSortIndexCol.getSort() ? [...allSortedColsWithoutChanges, lastSortIndexCol] : allSortedColsWithoutChanges;\n sortedColsWithIndices.forEach((col, idx) => (col.setSortIndex(idx)));\n }\n // gets called by API, so if data changes, use can call this, which will end up\n // working out the sort order again of the rows.\n onSortChanged(source) {\n this.dispatchSortChangedEvents(source);\n }\n isSortActive() {\n // pull out all the columns that have sorting set\n const allCols = this.columnModel.getPrimaryAndSecondaryAndAutoColumns();\n const sortedCols = allCols.filter(column => !!column.getSort());\n return sortedCols && sortedCols.length > 0;\n }\n dispatchSortChangedEvents(source) {\n const event = {\n type: Events.EVENT_SORT_CHANGED,\n source\n };\n this.eventService.dispatchEvent(event);\n }\n clearSortBarTheseColumns(columnsToSkip, source) {\n this.columnModel.getPrimaryAndSecondaryAndAutoColumns().forEach((columnToClear) => {\n // Do not clear if either holding shift, or if column in question was clicked\n if (!columnsToSkip.includes(columnToClear)) {\n // setting to 'undefined' as null means 'none' rather than cleared, otherwise issue will arise\n // if sort order is: ['desc', null , 'asc'], as it will start at null rather than 'desc'.\n columnToClear.setSort(undefined, source);\n }\n });\n }\n getNextSortDirection(column) {\n let sortingOrder;\n if (column.getColDef().sortingOrder) {\n sortingOrder = column.getColDef().sortingOrder;\n }\n else if (this.gridOptionsService.get('sortingOrder')) {\n sortingOrder = this.gridOptionsService.get('sortingOrder');\n }\n else {\n sortingOrder = SortController_1.DEFAULT_SORTING_ORDER;\n }\n if (!Array.isArray(sortingOrder) || sortingOrder.length <= 0) {\n console.warn(`AG Grid: sortingOrder must be an array with at least one element, currently it\\'s ${sortingOrder}`);\n return null;\n }\n const currentIndex = sortingOrder.indexOf(column.getSort());\n const notInArray = currentIndex < 0;\n const lastItemInArray = currentIndex == sortingOrder.length - 1;\n let result;\n if (notInArray || lastItemInArray) {\n result = sortingOrder[0];\n }\n else {\n result = sortingOrder[currentIndex + 1];\n }\n // verify the sort type exists, as the user could provide the sortingOrder, need to make sure it's valid\n if (SortController_1.DEFAULT_SORTING_ORDER.indexOf(result) < 0) {\n console.warn('AG Grid: invalid sort type ' + result);\n return null;\n }\n return result;\n }\n /**\n * @param includeRedundantColumns whether to include non-grouped, non-secondary, non-aggregated columns when pivot active\n * @returns a map of sort indexes for every sorted column, if groups sort primaries then they will have equivalent indices\n */\n getIndexedSortMap() {\n // pull out all the columns that have sorting set\n let allSortedCols = this.columnModel.getPrimaryAndSecondaryAndAutoColumns()\n .filter(col => !!col.getSort());\n if (this.columnModel.isPivotMode()) {\n const isSortingLinked = this.gridOptionsService.isColumnsSortingCoupledToGroup();\n allSortedCols = allSortedCols.filter(col => {\n const isAggregated = !!col.getAggFunc();\n const isSecondary = !col.isPrimary();\n const isGroup = isSortingLinked ? this.columnModel.getGroupDisplayColumnForGroup(col.getId()) : col.getColDef().showRowGroup;\n return isAggregated || isSecondary || isGroup;\n });\n }\n const sortedRowGroupCols = this.columnModel.getRowGroupColumns()\n .filter(col => !!col.getSort());\n const isSortLinked = this.gridOptionsService.isColumnsSortingCoupledToGroup() && !!sortedRowGroupCols.length;\n if (isSortLinked) {\n allSortedCols = [\n ...new Set(\n // if linked sorting, replace all columns with the display group column for index purposes, and ensure uniqueness\n allSortedCols.map(col => { var _a; return (_a = this.columnModel.getGroupDisplayColumnForGroup(col.getId())) !== null && _a !== void 0 ? _a : col; }))\n ];\n }\n // when both cols are missing sortIndex, we use the position of the col in all cols list.\n // this means if colDefs only have sort, but no sortIndex, we deterministically pick which\n // cols is sorted by first.\n const allColsIndexes = {};\n allSortedCols.forEach((col, index) => allColsIndexes[col.getId()] = index);\n // put the columns in order of which one got sorted first\n allSortedCols.sort((a, b) => {\n const iA = a.getSortIndex();\n const iB = b.getSortIndex();\n if (iA != null && iB != null) {\n return iA - iB; // both present, normal comparison\n }\n else if (iA == null && iB == null) {\n // both missing, compare using column positions\n const posA = allColsIndexes[a.getId()];\n const posB = allColsIndexes[b.getId()];\n return posA > posB ? 1 : -1;\n }\n else if (iB == null) {\n return -1; // iB missing\n }\n else {\n return 1; // iA missing\n }\n });\n const indexMap = new Map();\n allSortedCols.forEach((col, idx) => indexMap.set(col, idx));\n // add the row group cols back\n if (isSortLinked) {\n sortedRowGroupCols.forEach(col => {\n const groupDisplayCol = this.columnModel.getGroupDisplayColumnForGroup(col.getId());\n indexMap.set(col, indexMap.get(groupDisplayCol));\n });\n }\n return indexMap;\n }\n getColumnsWithSortingOrdered() {\n // pull out all the columns that have sorting set\n return [...this.getIndexedSortMap().entries()]\n .sort(([col1, idx1], [col2, idx2]) => idx1 - idx2)\n .map(([col]) => col);\n }\n // used by server side row models, to sent sort to server\n getSortModel() {\n // because this is used by the SSRM, we include redundant options and let the server decide\n return this.getColumnsWithSortingOrdered().map(column => ({\n sort: column.getSort(),\n colId: column.getId()\n }));\n }\n getSortOptions() {\n // this is used for client side sorting, as such we can ignore redundant column sorts\n return this.getColumnsWithSortingOrdered().map(column => ({\n sort: column.getSort(),\n column\n }));\n }\n canColumnDisplayMixedSort(column) {\n const isColumnSortCouplingActive = this.gridOptionsService.isColumnsSortingCoupledToGroup();\n const isGroupDisplayColumn = !!column.getColDef().showRowGroup;\n return isColumnSortCouplingActive && isGroupDisplayColumn;\n }\n getDisplaySortForColumn(column) {\n const linkedColumns = this.columnModel.getSourceColumnsForGroupColumn(column);\n if (!this.canColumnDisplayMixedSort(column) || !(linkedColumns === null || linkedColumns === void 0 ? void 0 : linkedColumns.length)) {\n return column.getSort();\n }\n // if column has unique data, its sorting is independent - but can still be mixed\n const columnHasUniqueData = column.getColDef().field != null || !!column.getColDef().valueGetter;\n const sortableColumns = columnHasUniqueData ? [column, ...linkedColumns] : linkedColumns;\n const firstSort = sortableColumns[0].getSort();\n // the == is intentional, as null and undefined both represent no sort, which means they are equivalent\n const allMatch = sortableColumns.every(col => col.getSort() == firstSort);\n if (!allMatch) {\n return 'mixed';\n }\n return firstSort;\n }\n getDisplaySortIndexForColumn(column) {\n return this.getIndexedSortMap().get(column);\n }\n};\nSortController.DEFAULT_SORTING_ORDER = ['asc', 'desc', null];\n__decorate([\n Autowired('columnModel')\n], SortController.prototype, \"columnModel\", void 0);\nSortController = SortController_1 = __decorate([\n Bean('sortController')\n], SortController);\nexport { SortController };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Bean } from \"../context/context.mjs\";\nimport { Events } from \"../events.mjs\";\nlet ColumnHoverService = class ColumnHoverService extends BeanStub {\n setMouseOver(columns) {\n this.selectedColumns = columns;\n const event = {\n type: Events.EVENT_COLUMN_HOVER_CHANGED\n };\n this.eventService.dispatchEvent(event);\n }\n clearMouseOver() {\n this.selectedColumns = null;\n const event = {\n type: Events.EVENT_COLUMN_HOVER_CHANGED\n };\n this.eventService.dispatchEvent(event);\n }\n isHovered(column) {\n return !!this.selectedColumns && this.selectedColumns.indexOf(column) >= 0;\n }\n};\nColumnHoverService = __decorate([\n Bean('columnHoverService')\n], ColumnHoverService);\nexport { ColumnHoverService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nlet ColumnAnimationService = class ColumnAnimationService extends BeanStub {\n constructor() {\n super(...arguments);\n this.executeNextFuncs = [];\n this.executeLaterFuncs = [];\n this.active = false;\n this.animationThreadCount = 0;\n }\n postConstruct() {\n this.ctrlsService.whenReady(p => this.gridBodyCtrl = p.gridBodyCtrl);\n }\n isActive() {\n return this.active;\n }\n start() {\n if (this.active) {\n return;\n }\n if (this.gridOptionsService.is('suppressColumnMoveAnimation')) {\n return;\n }\n // if doing RTL, we don't animate open / close as due to how the pixels are inverted,\n // the animation moves all the row the the right rather than to the left (ie it's the static\n // columns that actually get their coordinates updated)\n if (this.gridOptionsService.is('enableRtl')) {\n return;\n }\n this.ensureAnimationCssClassPresent();\n this.active = true;\n }\n finish() {\n if (!this.active) {\n return;\n }\n this.flush();\n this.active = false;\n }\n executeNextVMTurn(func) {\n if (this.active) {\n this.executeNextFuncs.push(func);\n }\n else {\n func();\n }\n }\n executeLaterVMTurn(func) {\n if (this.active) {\n this.executeLaterFuncs.push(func);\n }\n else {\n func();\n }\n }\n ensureAnimationCssClassPresent() {\n // up the count, so we can tell if someone else has updated the count\n // by the time the 'wait' func executes\n this.animationThreadCount++;\n const animationThreadCountCopy = this.animationThreadCount;\n this.gridBodyCtrl.setColumnMovingCss(true);\n this.executeLaterFuncs.push(() => {\n // only remove the class if this thread was the last one to update it\n if (this.animationThreadCount === animationThreadCountCopy) {\n this.gridBodyCtrl.setColumnMovingCss(false);\n }\n });\n }\n flush() {\n const nowFuncs = this.executeNextFuncs;\n this.executeNextFuncs = [];\n const waitFuncs = this.executeLaterFuncs;\n this.executeLaterFuncs = [];\n if (nowFuncs.length === 0 && waitFuncs.length === 0) {\n return;\n }\n window.setTimeout(() => nowFuncs.forEach(func => func()), 0);\n window.setTimeout(() => waitFuncs.forEach(func => func()), 300);\n }\n};\n__decorate([\n Autowired('ctrlsService')\n], ColumnAnimationService.prototype, \"ctrlsService\", void 0);\n__decorate([\n PostConstruct\n], ColumnAnimationService.prototype, \"postConstruct\", null);\nColumnAnimationService = __decorate([\n Bean('columnAnimationService')\n], ColumnAnimationService);\nexport { ColumnAnimationService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Events } from \"../events.mjs\";\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { debounce } from \"../utils/function.mjs\";\nlet PaginationAutoPageSizeService = class PaginationAutoPageSizeService extends BeanStub {\n postConstruct() {\n this.ctrlsService.whenReady(p => {\n this.centerRowContainerCon = p.centerRowContainerCtrl;\n this.addManagedListener(this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, this.checkPageSize.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, this.checkPageSize.bind(this));\n this.checkPageSize();\n });\n }\n notActive() {\n return !this.gridOptionsService.is('paginationAutoPageSize') || this.centerRowContainerCon == null;\n }\n checkPageSize() {\n if (this.notActive()) {\n return;\n }\n const bodyHeight = this.centerRowContainerCon.getViewportSizeFeature().getBodyHeight();\n if (bodyHeight > 0) {\n const update = () => {\n const rowHeight = this.gridOptionsService.getRowHeightAsNumber();\n const newPageSize = Math.floor(bodyHeight / rowHeight);\n this.gridOptionsService.set('paginationPageSize', newPageSize);\n };\n if (!this.isBodyRendered) {\n update();\n this.isBodyRendered = true;\n }\n else {\n debounce(() => update(), 50)();\n }\n }\n else {\n this.isBodyRendered = false;\n }\n }\n};\n__decorate([\n Autowired('ctrlsService')\n], PaginationAutoPageSizeService.prototype, \"ctrlsService\", void 0);\n__decorate([\n PostConstruct\n], PaginationAutoPageSizeService.prototype, \"postConstruct\", null);\nPaginationAutoPageSizeService = __decorate([\n Bean('paginationAutoPageSizeService')\n], PaginationAutoPageSizeService);\nexport { PaginationAutoPageSizeService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean, PostConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nlet ValueCache = class ValueCache extends BeanStub {\n constructor() {\n super(...arguments);\n this.cacheVersion = 0;\n }\n init() {\n this.active = this.gridOptionsService.is('valueCache');\n this.neverExpires = this.gridOptionsService.is('valueCacheNeverExpires');\n }\n onDataChanged() {\n if (this.neverExpires) {\n return;\n }\n this.expire();\n }\n expire() {\n this.cacheVersion++;\n }\n setValue(rowNode, colId, value) {\n if (this.active) {\n if (rowNode.__cacheVersion !== this.cacheVersion) {\n rowNode.__cacheVersion = this.cacheVersion;\n rowNode.__cacheData = {};\n }\n rowNode.__cacheData[colId] = value;\n }\n }\n getValue(rowNode, colId) {\n if (!this.active || rowNode.__cacheVersion !== this.cacheVersion) {\n return undefined;\n }\n return rowNode.__cacheData[colId];\n }\n};\n__decorate([\n PostConstruct\n], ValueCache.prototype, \"init\", null);\nValueCache = __decorate([\n Bean('valueCache')\n], ValueCache);\nexport { ValueCache };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { ChangedPath } from \"../utils/changedPath.mjs\";\nimport { Events } from \"../events.mjs\";\n// Matches value in clipboard module\nconst SOURCE_PASTE = 'paste';\nlet ChangeDetectionService = class ChangeDetectionService extends BeanStub {\n init() {\n if (this.rowModel.getType() === 'clientSide') {\n this.clientSideRowModel = this.rowModel;\n }\n this.addManagedListener(this.eventService, Events.EVENT_CELL_VALUE_CHANGED, this.onCellValueChanged.bind(this));\n }\n onCellValueChanged(event) {\n // Clipboard service manages its own change detection, so no need to do it here.\n // The clipboard manages its own as otherwise this would happen once for every cell\n // that got updated as part of a paste operation, so e.g. if 100 cells in a paste operation,\n // this doChangeDetection would get called 100 times (once for each cell), instead clipboard\n // service executes the logic we have here once (in essence batching up all cell changes\n // into one change detection).\n if (event.source === SOURCE_PASTE) {\n return;\n }\n this.doChangeDetection(event.node, event.column);\n }\n doChangeDetection(rowNode, column) {\n if (this.gridOptionsService.is('suppressChangeDetection')) {\n return;\n }\n const nodesToRefresh = [rowNode];\n // step 1 of change detection is to update the aggregated values\n if (this.clientSideRowModel && !rowNode.isRowPinned()) {\n const onlyChangedColumns = this.gridOptionsService.is('aggregateOnlyChangedColumns');\n const changedPath = new ChangedPath(onlyChangedColumns, this.clientSideRowModel.getRootNode());\n changedPath.addParentNode(rowNode.parent, [column]);\n this.clientSideRowModel.doAggregate(changedPath);\n // add all nodes impacted by aggregation, as they need refreshed also.\n changedPath.forEachChangedNodeDepthFirst(rowNode => {\n nodesToRefresh.push(rowNode);\n });\n }\n // step 2 of change detection is to refresh the cells\n this.rowRenderer.refreshCells({ rowNodes: nodesToRefresh });\n }\n};\n__decorate([\n Autowired('rowModel')\n], ChangeDetectionService.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('rowRenderer')\n], ChangeDetectionService.prototype, \"rowRenderer\", void 0);\n__decorate([\n PostConstruct\n], ChangeDetectionService.prototype, \"init\", null);\nChangeDetectionService = __decorate([\n Bean('changeDetectionService')\n], ChangeDetectionService);\nexport { ChangeDetectionService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean } from \"../../context/context.mjs\";\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { loadTemplate } from \"../../utils/dom.mjs\";\nlet AgComponentUtils = class AgComponentUtils extends BeanStub {\n adaptFunction(propertyName, jsCompFunc) {\n const metadata = this.componentMetadataProvider.retrieve(propertyName);\n if (metadata && metadata.functionAdapter) {\n return metadata.functionAdapter(jsCompFunc);\n }\n return null;\n }\n adaptCellRendererFunction(callback) {\n class Adapter {\n refresh(params) {\n return false;\n }\n getGui() {\n return this.eGui;\n }\n init(params) {\n const callbackResult = callback(params);\n const type = typeof callbackResult;\n if (type === 'string' || type === 'number' || type === 'boolean') {\n this.eGui = loadTemplate('' + callbackResult + '');\n return;\n }\n if (callbackResult == null) {\n this.eGui = loadTemplate('');\n return;\n }\n this.eGui = callbackResult;\n }\n }\n return Adapter;\n }\n doesImplementIComponent(candidate) {\n if (!candidate) {\n return false;\n }\n return candidate.prototype && 'getGui' in candidate.prototype;\n }\n};\n__decorate([\n Autowired(\"componentMetadataProvider\")\n], AgComponentUtils.prototype, \"componentMetadataProvider\", void 0);\nAgComponentUtils = __decorate([\n Bean(\"agComponentUtils\")\n], AgComponentUtils);\nexport { AgComponentUtils };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, PostConstruct } from \"../../context/context.mjs\";\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nlet ComponentMetadataProvider = class ComponentMetadataProvider extends BeanStub {\n postConstruct() {\n this.componentMetaData = {\n dateComponent: {\n mandatoryMethodList: ['getDate', 'setDate'],\n optionalMethodList: ['afterGuiAttached', 'setInputPlaceholder', 'setInputAriaLabel']\n },\n detailCellRenderer: {\n mandatoryMethodList: [],\n optionalMethodList: ['refresh'],\n functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)\n },\n headerComponent: {\n mandatoryMethodList: [],\n optionalMethodList: ['refresh']\n },\n headerGroupComponent: {\n mandatoryMethodList: [],\n optionalMethodList: []\n },\n loadingCellRenderer: {\n mandatoryMethodList: [],\n optionalMethodList: []\n },\n loadingOverlayComponent: {\n mandatoryMethodList: [],\n optionalMethodList: []\n },\n noRowsOverlayComponent: {\n mandatoryMethodList: [],\n optionalMethodList: []\n },\n floatingFilterComponent: {\n mandatoryMethodList: ['onParentModelChanged'],\n optionalMethodList: ['afterGuiAttached']\n },\n floatingFilterWrapperComponent: {\n mandatoryMethodList: [],\n optionalMethodList: []\n },\n cellRenderer: {\n mandatoryMethodList: [],\n optionalMethodList: ['refresh', 'afterGuiAttached'],\n functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)\n },\n cellEditor: {\n mandatoryMethodList: ['getValue'],\n optionalMethodList: ['isPopup', 'isCancelBeforeStart', 'isCancelAfterEnd', 'getPopupPosition', 'focusIn', 'focusOut', 'afterGuiAttached']\n },\n innerRenderer: {\n mandatoryMethodList: [],\n optionalMethodList: ['afterGuiAttached'],\n functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)\n },\n fullWidthCellRenderer: {\n mandatoryMethodList: [],\n optionalMethodList: ['refresh', 'afterGuiAttached'],\n functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)\n },\n groupRowRenderer: {\n mandatoryMethodList: [],\n optionalMethodList: ['afterGuiAttached'],\n functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)\n },\n filter: {\n mandatoryMethodList: ['isFilterActive', 'doesFilterPass', 'getModel', 'setModel'],\n optionalMethodList: ['afterGuiAttached', 'afterGuiDetached', 'onNewRowsLoaded', 'getModelAsString', 'onFloatingFilterChanged', 'onAnyFilterChanged']\n },\n filterComponent: {\n mandatoryMethodList: ['isFilterActive', 'doesFilterPass', 'getModel', 'setModel'],\n optionalMethodList: ['afterGuiAttached', 'afterGuiDetached', 'onNewRowsLoaded', 'getModelAsString', 'onFloatingFilterChanged', 'onAnyFilterChanged']\n },\n statusPanel: {\n mandatoryMethodList: [],\n optionalMethodList: ['afterGuiAttached'],\n },\n toolPanel: {\n mandatoryMethodList: [],\n optionalMethodList: ['refresh', 'afterGuiAttached']\n },\n tooltipComponent: {\n mandatoryMethodList: [],\n optionalMethodList: []\n }\n };\n }\n retrieve(name) {\n return this.componentMetaData[name];\n }\n};\n__decorate([\n Autowired(\"agComponentUtils\")\n], ComponentMetadataProvider.prototype, \"agComponentUtils\", void 0);\n__decorate([\n PostConstruct\n], ComponentMetadataProvider.prototype, \"postConstruct\", null);\nComponentMetadataProvider = __decorate([\n Bean(\"componentMetadataProvider\")\n], ComponentMetadataProvider);\nexport { ComponentMetadataProvider };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean, Autowired, PostConstruct } from './context/context.mjs';\nimport { BeanStub } from \"./context/beanStub.mjs\";\nimport { exists } from './utils/generic.mjs';\nimport { Events } from './eventKeys.mjs';\nconst DEFAULT_ROW_HEIGHT = 25;\nconst MIN_COL_WIDTH = 10;\nconst MAT_GRID_SIZE = 8;\nconst BASE_GRID_SIZE = 4;\nconst BALHAM_GRID_SIZE = 4;\nconst ALPINE_GRID_SIZE = 6;\nconst HARD_CODED_SIZES = {\n // this item is required for custom themes\n 'ag-theme-custom': {\n headerHeight: 25,\n headerCellMinWidth: 24,\n listItemHeight: BASE_GRID_SIZE * 5,\n rowHeight: 25,\n chartMenuPanelWidth: 220\n },\n 'ag-theme-material': {\n headerHeight: MAT_GRID_SIZE * 7,\n headerCellMinWidth: 48,\n listItemHeight: MAT_GRID_SIZE * 4,\n rowHeight: MAT_GRID_SIZE * 6,\n chartMenuPanelWidth: 240\n },\n 'ag-theme-balham': {\n headerHeight: BALHAM_GRID_SIZE * 8,\n headerCellMinWidth: 24,\n listItemHeight: BALHAM_GRID_SIZE * 6,\n rowHeight: BALHAM_GRID_SIZE * 7,\n chartMenuPanelWidth: 220\n },\n 'ag-theme-alpine': {\n headerHeight: ALPINE_GRID_SIZE * 8,\n headerCellMinWidth: 36,\n listItemHeight: ALPINE_GRID_SIZE * 4,\n rowHeight: ALPINE_GRID_SIZE * 7,\n chartMenuPanelWidth: 240\n }\n};\n/**\n * this object contains a list of Sass variables and an array\n * of CSS styles required to get the correct value.\n * eg. $virtual-item-height requires a structure, so we can get its height.\n *
\n *
\n *
\n *
\n *
\n */\nconst SASS_PROPERTY_BUILDER = {\n headerHeight: ['ag-header-row'],\n headerCellMinWidth: ['ag-header-cell'],\n listItemHeight: ['ag-virtual-list-item'],\n rowHeight: ['ag-row'],\n chartMenuPanelWidth: ['ag-chart-docked-container']\n};\nlet Environment = class Environment extends BeanStub {\n constructor() {\n super(...arguments);\n this.calculatedSizes = {};\n }\n postConstruct() {\n var _a;\n const el = (_a = this.getTheme().el) !== null && _a !== void 0 ? _a : this.eGridDiv;\n this.mutationObserver = new MutationObserver(() => {\n this.calculatedSizes = {};\n this.fireGridStylesChangedEvent();\n });\n this.mutationObserver.observe(el || this.eGridDiv, {\n attributes: true,\n attributeFilter: ['class']\n });\n }\n fireGridStylesChangedEvent() {\n const event = {\n type: Events.EVENT_GRID_STYLES_CHANGED\n };\n this.eventService.dispatchEvent(event);\n }\n getSassVariable(key) {\n const { themeFamily, el } = this.getTheme();\n if (!themeFamily || themeFamily.indexOf('ag-theme') !== 0) {\n return;\n }\n if (!this.calculatedSizes) {\n this.calculatedSizes = {};\n }\n if (!this.calculatedSizes[themeFamily]) {\n this.calculatedSizes[themeFamily] = {};\n }\n const size = this.calculatedSizes[themeFamily][key];\n if (size != null) {\n return size;\n }\n this.calculatedSizes[themeFamily][key] = this.calculateValueForSassProperty(key, themeFamily, el);\n return this.calculatedSizes[themeFamily][key];\n }\n calculateValueForSassProperty(property, theme, themeElement) {\n const useTheme = 'ag-theme-' + (theme.match('material') ? 'material' : theme.match('balham') ? 'balham' : theme.match('alpine') ? 'alpine' : 'custom');\n const defaultValue = HARD_CODED_SIZES[useTheme][property];\n const eDocument = this.gridOptionsService.getDocument();\n if (!themeElement) {\n themeElement = this.eGridDiv;\n }\n if (!SASS_PROPERTY_BUILDER[property]) {\n return defaultValue;\n }\n const classList = SASS_PROPERTY_BUILDER[property];\n const div = eDocument.createElement('div');\n // this will apply SASS variables that were manually added to the current theme\n const classesFromThemeElement = Array.from(themeElement.classList);\n div.classList.add(theme, ...classesFromThemeElement);\n div.style.position = 'absolute';\n const el = classList.reduce((prevEl, currentClass) => {\n const currentDiv = eDocument.createElement('div');\n currentDiv.style.position = 'static';\n currentDiv.classList.add(currentClass);\n prevEl.appendChild(currentDiv);\n return currentDiv;\n }, div);\n let calculatedValue = 0;\n if (eDocument.body) {\n eDocument.body.appendChild(div);\n const sizeName = property.toLowerCase().indexOf('height') !== -1 ? 'height' : 'width';\n calculatedValue = parseInt(window.getComputedStyle(el)[sizeName], 10);\n eDocument.body.removeChild(div);\n }\n return calculatedValue || defaultValue;\n }\n isThemeDark() {\n const { theme } = this.getTheme();\n return !!theme && theme.indexOf('dark') >= 0;\n }\n chartMenuPanelWidth() {\n return this.getSassVariable('chartMenuPanelWidth');\n }\n getTheme() {\n const reg = /\\bag-(material|(?:theme-([\\w\\-]*)))\\b/g;\n let el = this.eGridDiv;\n let themeMatch = null;\n let allThemes = [];\n while (el) {\n themeMatch = reg.exec(el.className);\n if (!themeMatch) {\n el = el.parentElement || undefined;\n }\n else {\n const matched = el.className.match(reg);\n if (matched) {\n allThemes = matched;\n }\n break;\n }\n }\n if (!themeMatch) {\n return { allThemes };\n }\n const theme = themeMatch[0];\n return { theme, el, themeFamily: theme.replace(/-dark$/, ''), allThemes };\n }\n getFromTheme(defaultValue, sassVariableName) {\n var _a;\n return (_a = this.getSassVariable(sassVariableName)) !== null && _a !== void 0 ? _a : defaultValue;\n }\n getDefaultRowHeight() {\n return this.getFromTheme(DEFAULT_ROW_HEIGHT, 'rowHeight');\n }\n getListItemHeight() {\n return this.getFromTheme(20, 'listItemHeight');\n }\n setRowHeightVariable(height) {\n const oldRowHeight = this.eGridDiv.style.getPropertyValue('--ag-line-height').trim();\n const newRowHeight = `${height}px`;\n if (oldRowHeight != newRowHeight) {\n this.eGridDiv.style.setProperty('--ag-line-height', newRowHeight);\n }\n }\n getMinColWidth() {\n const measuredMin = this.getFromTheme(null, 'headerCellMinWidth');\n return exists(measuredMin) ? Math.max(measuredMin, MIN_COL_WIDTH) : MIN_COL_WIDTH;\n }\n destroy() {\n this.calculatedSizes = null;\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n super.destroy();\n }\n};\n__decorate([\n Autowired('eGridDiv')\n], Environment.prototype, \"eGridDiv\", void 0);\n__decorate([\n PostConstruct\n], Environment.prototype, \"postConstruct\", null);\nEnvironment = __decorate([\n Bean('environment')\n], Environment);\nexport { Environment };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Autowired, Bean, PostConstruct, Qualifier } from \"../context/context.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { getMaxDivHeight } from \"../utils/browser.mjs\";\n/**\n * This class solves the 'max height' problem, where the user might want to show more data than\n * the max div height actually allows.\n */\nlet RowContainerHeightService = class RowContainerHeightService extends BeanStub {\n constructor() {\n super(...arguments);\n // the scrollY position\n this.scrollY = 0;\n // how tall the body is\n this.uiBodyHeight = 0;\n }\n agWire(loggerFactory) {\n this.logger = loggerFactory.create(\"RowContainerHeightService\");\n }\n postConstruct() {\n this.addManagedListener(this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, this.updateOffset.bind(this));\n this.maxDivHeight = getMaxDivHeight();\n this.logger.log('maxDivHeight = ' + this.maxDivHeight);\n }\n isStretching() {\n return this.stretching;\n }\n getDivStretchOffset() {\n return this.divStretchOffset;\n }\n updateOffset() {\n if (!this.stretching) {\n return;\n }\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n const newScrollY = gridBodyCon.getScrollFeature().getVScrollPosition().top;\n const newBodyHeight = this.getUiBodyHeight();\n const atLeastOneChanged = newScrollY !== this.scrollY || newBodyHeight !== this.uiBodyHeight;\n if (atLeastOneChanged) {\n this.scrollY = newScrollY;\n this.uiBodyHeight = newBodyHeight;\n this.calculateOffset();\n }\n }\n calculateOffset() {\n this.setUiContainerHeight(this.maxDivHeight);\n this.pixelsToShave = this.modelHeight - this.uiContainerHeight;\n this.maxScrollY = this.uiContainerHeight - this.uiBodyHeight;\n const scrollPercent = this.scrollY / this.maxScrollY;\n const divStretchOffset = scrollPercent * this.pixelsToShave;\n this.logger.log(`Div Stretch Offset = ${divStretchOffset} (${this.pixelsToShave} * ${scrollPercent})`);\n this.setDivStretchOffset(divStretchOffset);\n }\n setUiContainerHeight(height) {\n if (height !== this.uiContainerHeight) {\n this.uiContainerHeight = height;\n this.eventService.dispatchEvent({ type: Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED });\n }\n }\n clearOffset() {\n this.setUiContainerHeight(this.modelHeight);\n this.pixelsToShave = 0;\n this.setDivStretchOffset(0);\n }\n setDivStretchOffset(newOffset) {\n // because we are talking pixels, no point in confusing things with half numbers\n const newOffsetFloor = typeof newOffset === 'number' ? Math.floor(newOffset) : null;\n if (this.divStretchOffset === newOffsetFloor) {\n return;\n }\n this.divStretchOffset = newOffsetFloor;\n this.eventService.dispatchEvent({ type: Events.EVENT_HEIGHT_SCALE_CHANGED });\n }\n setModelHeight(modelHeight) {\n this.modelHeight = modelHeight;\n this.stretching = modelHeight != null // null happens when in print layout\n && this.maxDivHeight > 0\n && modelHeight > this.maxDivHeight;\n if (this.stretching) {\n this.calculateOffset();\n }\n else {\n this.clearOffset();\n }\n }\n getUiContainerHeight() {\n return this.uiContainerHeight;\n }\n getRealPixelPosition(modelPixel) {\n return modelPixel - this.divStretchOffset;\n }\n getUiBodyHeight() {\n const gridBodyCon = this.ctrlsService.getGridBodyCtrl();\n const pos = gridBodyCon.getScrollFeature().getVScrollPosition();\n return pos.bottom - pos.top;\n }\n getScrollPositionForPixel(rowTop) {\n if (this.pixelsToShave <= 0) {\n return rowTop;\n }\n const modelMaxScroll = this.modelHeight - this.getUiBodyHeight();\n const scrollPercent = rowTop / modelMaxScroll;\n const scrollPixel = this.maxScrollY * scrollPercent;\n return scrollPixel;\n }\n};\n__decorate([\n Autowired('ctrlsService')\n], RowContainerHeightService.prototype, \"ctrlsService\", void 0);\n__decorate([\n __param(0, Qualifier(\"loggerFactory\"))\n], RowContainerHeightService.prototype, \"agWire\", null);\n__decorate([\n PostConstruct\n], RowContainerHeightService.prototype, \"postConstruct\", null);\nRowContainerHeightService = __decorate([\n Bean('rowContainerHeightService')\n], RowContainerHeightService);\nexport { RowContainerHeightService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean, PostConstruct } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nlet SelectableService = class SelectableService extends BeanStub {\n init() {\n this.groupSelectsChildren = this.gridOptionsService.is('groupSelectsChildren');\n this.isRowSelectableFunc = this.gridOptionsService.get('isRowSelectable');\n }\n updateSelectableAfterGrouping(rowNode) {\n if (this.isRowSelectableFunc) {\n const nextChildrenFunc = (node) => node.childrenAfterGroup;\n this.recurseDown(rowNode.childrenAfterGroup, nextChildrenFunc);\n }\n }\n recurseDown(children, nextChildrenFunc) {\n if (!children) {\n return;\n }\n children.forEach((child) => {\n if (!child.group) {\n return;\n } // only interested in groups\n if (child.hasChildren()) {\n this.recurseDown(nextChildrenFunc(child), nextChildrenFunc);\n }\n let rowSelectable;\n if (this.groupSelectsChildren) {\n // have this group selectable if at least one direct child is selectable\n const firstSelectable = (nextChildrenFunc(child) || []).find(rowNode => rowNode.selectable === true);\n rowSelectable = exists(firstSelectable);\n }\n else {\n // directly retrieve selectable value from user callback\n rowSelectable = this.isRowSelectableFunc ? this.isRowSelectableFunc(child) : false;\n }\n child.setRowSelectable(rowSelectable);\n });\n }\n};\n__decorate([\n PostConstruct\n], SelectableService.prototype, \"init\", null);\nSelectableService = __decorate([\n Bean('selectableService')\n], SelectableService);\nexport { SelectableService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component } from \"../widgets/component.mjs\";\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { RefSelector } from \"../widgets/componentAnnotations.mjs\";\nimport { Events } from \"../events.mjs\";\nimport { createIconNoSpan } from \"../utils/icon.mjs\";\nimport { formatNumberCommas } from \"../utils/number.mjs\";\nimport { setAriaDisabled } from \"../utils/aria.mjs\";\nimport { KeyCode } from '../constants/keyCode.mjs';\nexport class PaginationComp extends Component {\n constructor() {\n super();\n this.previousAndFirstButtonsDisabled = false;\n this.nextButtonDisabled = false;\n this.lastButtonDisabled = false;\n this.areListenersSetup = false;\n }\n postConstruct() {\n const isRtl = this.gridOptionsService.is('enableRtl');\n this.setTemplate(this.getTemplate());\n const { btFirst, btPrevious, btNext, btLast } = this;\n this.activateTabIndex([btFirst, btPrevious, btNext, btLast]);\n btFirst.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'last' : 'first', this.gridOptionsService));\n btPrevious.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'next' : 'previous', this.gridOptionsService));\n btNext.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'previous' : 'next', this.gridOptionsService));\n btLast.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'first' : 'last', this.gridOptionsService));\n this.addManagedPropertyListener('pagination', this.onPaginationChanged.bind(this));\n this.addManagedPropertyListener('suppressPaginationPanel', this.onPaginationChanged.bind(this));\n this.onPaginationChanged();\n }\n onPaginationChanged() {\n const isPaging = this.gridOptionsService.is('pagination');\n const paginationPanelEnabled = isPaging && !this.gridOptionsService.is('suppressPaginationPanel');\n this.setDisplayed(paginationPanelEnabled);\n if (!paginationPanelEnabled) {\n return;\n }\n this.setupListeners();\n this.enableOrDisableButtons();\n this.updateRowLabels();\n this.setCurrentPageLabel();\n this.setTotalLabels();\n }\n setupListeners() {\n if (!this.areListenersSetup) {\n this.addManagedListener(this.eventService, Events.EVENT_PAGINATION_CHANGED, this.onPaginationChanged.bind(this));\n [\n { el: this.btFirst, fn: this.onBtFirst.bind(this) },\n { el: this.btPrevious, fn: this.onBtPrevious.bind(this) },\n { el: this.btNext, fn: this.onBtNext.bind(this) },\n { el: this.btLast, fn: this.onBtLast.bind(this) }\n ].forEach(item => {\n const { el, fn } = item;\n this.addManagedListener(el, 'click', fn);\n this.addManagedListener(el, 'keydown', (e) => {\n if (e.key === KeyCode.ENTER || e.key === KeyCode.SPACE) {\n e.preventDefault();\n fn();\n }\n });\n });\n this.areListenersSetup = true;\n }\n }\n onBtFirst() {\n if (!this.previousAndFirstButtonsDisabled) {\n this.paginationProxy.goToFirstPage();\n }\n }\n setCurrentPageLabel() {\n const pagesExist = this.paginationProxy.getTotalPages() > 0;\n const currentPage = this.paginationProxy.getCurrentPage();\n const toDisplay = pagesExist ? currentPage + 1 : 0;\n this.lbCurrent.innerHTML = this.formatNumber(toDisplay);\n }\n formatNumber(value) {\n const userFunc = this.gridOptionsService.getCallback('paginationNumberFormatter');\n if (userFunc) {\n const params = { value: value };\n return userFunc(params);\n }\n const localeTextFunc = this.localeService.getLocaleTextFunc();\n const thousandSeparator = localeTextFunc('thousandSeparator', ',');\n const decimalSeparator = localeTextFunc('decimalSeparator', '.');\n return formatNumberCommas(value, thousandSeparator, decimalSeparator);\n }\n getTemplate() {\n const localeTextFunc = this.localeService.getLocaleTextFunc();\n const strPage = localeTextFunc('page', 'Page');\n const strTo = localeTextFunc('to', 'to');\n const strOf = localeTextFunc('of', 'of');\n const strFirst = localeTextFunc('firstPage', 'First Page');\n const strPrevious = localeTextFunc('previousPage', 'Previous Page');\n const strNext = localeTextFunc('nextPage', 'Next Page');\n const strLast = localeTextFunc('lastPage', 'Last Page');\n const compId = this.getCompId();\n return /* html */ `
\n \n \n ${strTo}\n \n ${strOf}\n \n \n \n
\n
\n \n ${strPage}\n \n ${strOf}\n \n \n
\n
\n
\n
`;\n }\n onBtNext() {\n if (!this.nextButtonDisabled) {\n this.paginationProxy.goToNextPage();\n }\n }\n onBtPrevious() {\n if (!this.previousAndFirstButtonsDisabled) {\n this.paginationProxy.goToPreviousPage();\n }\n }\n onBtLast() {\n if (!this.lastButtonDisabled) {\n this.paginationProxy.goToLastPage();\n }\n }\n enableOrDisableButtons() {\n const currentPage = this.paginationProxy.getCurrentPage();\n const maxRowFound = this.paginationProxy.isLastPageFound();\n const totalPages = this.paginationProxy.getTotalPages();\n this.previousAndFirstButtonsDisabled = currentPage === 0;\n this.toggleButtonDisabled(this.btFirst, this.previousAndFirstButtonsDisabled);\n this.toggleButtonDisabled(this.btPrevious, this.previousAndFirstButtonsDisabled);\n const zeroPagesToDisplay = this.isZeroPagesToDisplay();\n const onLastPage = maxRowFound && currentPage === (totalPages - 1);\n this.nextButtonDisabled = onLastPage || zeroPagesToDisplay;\n this.lastButtonDisabled = !maxRowFound || zeroPagesToDisplay || currentPage === (totalPages - 1);\n this.toggleButtonDisabled(this.btNext, this.nextButtonDisabled);\n this.toggleButtonDisabled(this.btLast, this.lastButtonDisabled);\n }\n toggleButtonDisabled(button, disabled) {\n setAriaDisabled(button, disabled);\n button.classList.toggle('ag-disabled', disabled);\n }\n updateRowLabels() {\n const currentPage = this.paginationProxy.getCurrentPage();\n const pageSize = this.paginationProxy.getPageSize();\n const maxRowFound = this.paginationProxy.isLastPageFound();\n const rowCount = this.paginationProxy.isLastPageFound() ?\n this.paginationProxy.getMasterRowCount() : null;\n let startRow;\n let endRow;\n if (this.isZeroPagesToDisplay()) {\n startRow = endRow = 0;\n }\n else {\n startRow = (pageSize * currentPage) + 1;\n endRow = startRow + pageSize - 1;\n if (maxRowFound && endRow > rowCount) {\n endRow = rowCount;\n }\n }\n this.lbFirstRowOnPage.innerHTML = this.formatNumber(startRow);\n if (this.rowNodeBlockLoader.isLoading()) {\n const translate = this.localeService.getLocaleTextFunc();\n this.lbLastRowOnPage.innerHTML = translate('pageLastRowUnknown', '?');\n }\n else {\n this.lbLastRowOnPage.innerHTML = this.formatNumber(endRow);\n }\n }\n isZeroPagesToDisplay() {\n const maxRowFound = this.paginationProxy.isLastPageFound();\n const totalPages = this.paginationProxy.getTotalPages();\n return maxRowFound && totalPages === 0;\n }\n setTotalLabels() {\n const lastPageFound = this.paginationProxy.isLastPageFound();\n const totalPages = this.paginationProxy.getTotalPages();\n const rowCount = lastPageFound ? this.paginationProxy.getMasterRowCount() : null;\n // When `pivotMode=true` and no grouping or value columns exist, a single 'hidden' group row (root node) is in\n // the grid and the pagination totals will correctly display total = 1. However this is confusing to users as\n // they can't see it. To address this UX issue we simply set the totals to zero in the pagination panel.\n if (rowCount === 1) {\n const firstRow = this.paginationProxy.getRow(0);\n // a group node with no group or agg data will not be visible to users\n const hiddenGroupRow = firstRow && firstRow.group && !(firstRow.groupData || firstRow.aggData);\n if (hiddenGroupRow) {\n this.setTotalLabelsToZero();\n return;\n }\n }\n if (lastPageFound) {\n this.lbTotal.innerHTML = this.formatNumber(totalPages);\n this.lbRecordCount.innerHTML = this.formatNumber(rowCount);\n }\n else {\n const moreText = this.localeService.getLocaleTextFunc()('more', 'more');\n this.lbTotal.innerHTML = moreText;\n this.lbRecordCount.innerHTML = moreText;\n }\n }\n setTotalLabelsToZero() {\n this.lbFirstRowOnPage.innerHTML = this.formatNumber(0);\n this.lbCurrent.innerHTML = this.formatNumber(0);\n this.lbLastRowOnPage.innerHTML = this.formatNumber(0);\n this.lbTotal.innerHTML = this.formatNumber(0);\n this.lbRecordCount.innerHTML = this.formatNumber(0);\n }\n}\n__decorate([\n Autowired('paginationProxy')\n], PaginationComp.prototype, \"paginationProxy\", void 0);\n__decorate([\n Autowired('rowNodeBlockLoader')\n], PaginationComp.prototype, \"rowNodeBlockLoader\", void 0);\n__decorate([\n RefSelector('btFirst')\n], PaginationComp.prototype, \"btFirst\", void 0);\n__decorate([\n RefSelector('btPrevious')\n], PaginationComp.prototype, \"btPrevious\", void 0);\n__decorate([\n RefSelector('btNext')\n], PaginationComp.prototype, \"btNext\", void 0);\n__decorate([\n RefSelector('btLast')\n], PaginationComp.prototype, \"btLast\", void 0);\n__decorate([\n RefSelector('lbRecordCount')\n], PaginationComp.prototype, \"lbRecordCount\", void 0);\n__decorate([\n RefSelector('lbFirstRowOnPage')\n], PaginationComp.prototype, \"lbFirstRowOnPage\", void 0);\n__decorate([\n RefSelector('lbLastRowOnPage')\n], PaginationComp.prototype, \"lbLastRowOnPage\", void 0);\n__decorate([\n RefSelector('lbCurrent')\n], PaginationComp.prototype, \"lbCurrent\", void 0);\n__decorate([\n RefSelector('lbTotal')\n], PaginationComp.prototype, \"lbTotal\", void 0);\n__decorate([\n PostConstruct\n], PaginationComp.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from '../../context/context.mjs';\nimport { Component } from '../../widgets/component.mjs';\nimport { RefSelector } from '../../widgets/componentAnnotations.mjs';\nimport { clearElement } from '../../utils/dom.mjs';\nimport { LayoutCssClasses, LayoutFeature } from \"../../styling/layoutFeature.mjs\";\nimport { Events } from \"../../eventKeys.mjs\";\nvar LoadingType;\n(function (LoadingType) {\n LoadingType[LoadingType[\"Loading\"] = 0] = \"Loading\";\n LoadingType[LoadingType[\"NoRows\"] = 1] = \"NoRows\";\n})(LoadingType || (LoadingType = {}));\nexport class OverlayWrapperComponent extends Component {\n constructor() {\n super(OverlayWrapperComponent.TEMPLATE);\n this.inProgress = false;\n this.destroyRequested = false;\n this.manuallyDisplayed = false;\n }\n updateLayoutClasses(cssClass, params) {\n const overlayWrapperClassList = this.eOverlayWrapper.classList;\n overlayWrapperClassList.toggle(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);\n overlayWrapperClassList.toggle(LayoutCssClasses.NORMAL, params.normal);\n overlayWrapperClassList.toggle(LayoutCssClasses.PRINT, params.print);\n }\n postConstruct() {\n this.createManagedBean(new LayoutFeature(this));\n this.setDisplayed(false, { skipAriaHidden: true });\n this.addManagedListener(this.eventService, Events.EVENT_ROW_DATA_UPDATED, this.onRowDataUpdated.bind(this));\n this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onNewColumnsLoaded.bind(this));\n if (this.gridOptionsService.isRowModelType('clientSide') && !this.gridOptionsService.get('rowData')) {\n this.showLoadingOverlay();\n }\n this.gridApi.registerOverlayWrapperComp(this);\n }\n setWrapperTypeClass(loadingType) {\n const overlayWrapperClassList = this.eOverlayWrapper.classList;\n overlayWrapperClassList.toggle('ag-overlay-loading-wrapper', loadingType === LoadingType.Loading);\n overlayWrapperClassList.toggle('ag-overlay-no-rows-wrapper', loadingType === LoadingType.NoRows);\n }\n showLoadingOverlay() {\n if (this.gridOptionsService.is('suppressLoadingOverlay')) {\n return;\n }\n const params = {};\n const compDetails = this.userComponentFactory.getLoadingOverlayCompDetails(params);\n const promise = compDetails.newAgStackInstance();\n this.showOverlay(promise, LoadingType.Loading);\n }\n showNoRowsOverlay() {\n if (this.gridOptionsService.is('suppressNoRowsOverlay')) {\n return;\n }\n const params = {};\n const compDetails = this.userComponentFactory.getNoRowsOverlayCompDetails(params);\n const promise = compDetails.newAgStackInstance();\n this.showOverlay(promise, LoadingType.NoRows);\n }\n showOverlay(workItem, type) {\n if (this.inProgress) {\n return;\n }\n this.setWrapperTypeClass(type);\n this.destroyActiveOverlay();\n this.inProgress = true;\n if (workItem) {\n workItem.then(comp => {\n this.inProgress = false;\n this.eOverlayWrapper.appendChild(comp.getGui());\n this.activeOverlay = comp;\n if (this.destroyRequested) {\n this.destroyRequested = false;\n this.destroyActiveOverlay();\n }\n });\n }\n this.manuallyDisplayed = this.columnModel.isReady() && !this.paginationProxy.isEmpty();\n this.setDisplayed(true, { skipAriaHidden: true });\n }\n destroyActiveOverlay() {\n if (this.inProgress) {\n this.destroyRequested = true;\n return;\n }\n if (!this.activeOverlay) {\n return;\n }\n this.activeOverlay = this.getContext().destroyBean(this.activeOverlay);\n clearElement(this.eOverlayWrapper);\n }\n hideOverlay() {\n this.manuallyDisplayed = false;\n this.destroyActiveOverlay();\n this.setDisplayed(false, { skipAriaHidden: true });\n }\n destroy() {\n this.destroyActiveOverlay();\n super.destroy();\n }\n showOrHideOverlay() {\n const isEmpty = this.paginationProxy.isEmpty();\n const isSuppressNoRowsOverlay = this.gridOptionsService.is('suppressNoRowsOverlay');\n if (isEmpty && !isSuppressNoRowsOverlay) {\n this.showNoRowsOverlay();\n }\n else {\n this.hideOverlay();\n }\n }\n onRowDataUpdated() {\n this.showOrHideOverlay();\n }\n onNewColumnsLoaded() {\n // hide overlay if columns and rows exist, this can happen if columns are loaded after data.\n // this problem exists before of the race condition between the services (column controller in this case)\n // and the view (grid panel). if the model beans were all initialised first, and then the view beans second,\n // this race condition would not happen.\n if (this.columnModel.isReady() && !this.paginationProxy.isEmpty() && !this.manuallyDisplayed) {\n this.hideOverlay();\n }\n }\n}\n// wrapping in outer div, and wrapper, is needed to center the loading icon\nOverlayWrapperComponent.TEMPLATE = `\n
\n
\n
\n
\n
`;\n__decorate([\n Autowired('userComponentFactory')\n], OverlayWrapperComponent.prototype, \"userComponentFactory\", void 0);\n__decorate([\n Autowired('paginationProxy')\n], OverlayWrapperComponent.prototype, \"paginationProxy\", void 0);\n__decorate([\n Autowired('gridApi')\n], OverlayWrapperComponent.prototype, \"gridApi\", void 0);\n__decorate([\n Autowired('columnModel')\n], OverlayWrapperComponent.prototype, \"columnModel\", void 0);\n__decorate([\n RefSelector('eOverlayWrapper')\n], OverlayWrapperComponent.prototype, \"eOverlayWrapper\", void 0);\n__decorate([\n PostConstruct\n], OverlayWrapperComponent.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { exists } from \"../utils/generic.mjs\";\nlet RowPositionUtils = class RowPositionUtils extends BeanStub {\n getFirstRow() {\n let rowIndex = 0;\n let rowPinned;\n if (this.pinnedRowModel.getPinnedTopRowCount()) {\n rowPinned = 'top';\n }\n else if (this.rowModel.getRowCount()) {\n rowPinned = null;\n rowIndex = this.paginationProxy.getPageFirstRow();\n }\n else if (this.pinnedRowModel.getPinnedBottomRowCount()) {\n rowPinned = 'bottom';\n }\n return rowPinned === undefined ? null : { rowIndex, rowPinned };\n }\n getLastRow() {\n let rowIndex;\n let rowPinned = null;\n const pinnedBottomCount = this.pinnedRowModel.getPinnedBottomRowCount();\n const pinnedTopCount = this.pinnedRowModel.getPinnedTopRowCount();\n if (pinnedBottomCount) {\n rowPinned = 'bottom';\n rowIndex = pinnedBottomCount - 1;\n }\n else if (this.rowModel.getRowCount()) {\n rowPinned = null;\n rowIndex = this.paginationProxy.getPageLastRow();\n }\n else if (pinnedTopCount) {\n rowPinned = 'top';\n rowIndex = pinnedTopCount - 1;\n }\n return rowIndex === undefined ? null : { rowIndex, rowPinned };\n }\n getRowNode(gridRow) {\n switch (gridRow.rowPinned) {\n case 'top':\n return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];\n case 'bottom':\n return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];\n default:\n return this.rowModel.getRow(gridRow.rowIndex);\n }\n }\n sameRow(rowA, rowB) {\n // if both missing\n if (!rowA && !rowB) {\n return true;\n }\n // if only one missing\n if ((rowA && !rowB) || (!rowA && rowB)) {\n return false;\n }\n // otherwise compare (use == to compare rowPinned because it can be null or undefined)\n return rowA.rowIndex === rowB.rowIndex && rowA.rowPinned == rowB.rowPinned;\n }\n // tests if this row selection is before the other row selection\n before(rowA, rowB) {\n switch (rowA.rowPinned) {\n case 'top':\n // we we are floating top, and other isn't, then we are always before\n if (rowB.rowPinned !== 'top') {\n return true;\n }\n break;\n case 'bottom':\n // if we are floating bottom, and the other isn't, then we are never before\n if (rowB.rowPinned !== 'bottom') {\n return false;\n }\n break;\n default:\n // if we are not floating, but the other one is floating...\n if (exists(rowB.rowPinned)) {\n return rowB.rowPinned !== 'top';\n }\n break;\n }\n return rowA.rowIndex < rowB.rowIndex;\n }\n rowMax(rows) {\n let max;\n rows.forEach((row) => {\n if (max === undefined || this.before(max, row)) {\n max = row;\n }\n });\n return max;\n }\n rowMin(rows) {\n let min;\n rows.forEach((row) => {\n if (min === undefined || this.before(row, min)) {\n min = row;\n }\n });\n return min;\n }\n};\n__decorate([\n Autowired('rowModel')\n], RowPositionUtils.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('pinnedRowModel')\n], RowPositionUtils.prototype, \"pinnedRowModel\", void 0);\n__decorate([\n Autowired('paginationProxy')\n], RowPositionUtils.prototype, \"paginationProxy\", void 0);\nRowPositionUtils = __decorate([\n Bean('rowPositionUtils')\n], RowPositionUtils);\nexport { RowPositionUtils };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean } from \"../context/context.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nlet CellPositionUtils = class CellPositionUtils extends BeanStub {\n createId(cellPosition) {\n const { rowIndex, rowPinned, column } = cellPosition;\n return this.createIdFromValues({ rowIndex, column, rowPinned });\n }\n createIdFromValues(cellPosition) {\n const { rowIndex, rowPinned, column } = cellPosition;\n return `${rowIndex}.${rowPinned == null ? 'null' : rowPinned}.${column.getId()}`;\n }\n equals(cellA, cellB) {\n const colsMatch = cellA.column === cellB.column;\n const floatingMatch = cellA.rowPinned === cellB.rowPinned;\n const indexMatch = cellA.rowIndex === cellB.rowIndex;\n return colsMatch && floatingMatch && indexMatch;\n }\n};\nCellPositionUtils = __decorate([\n Bean('cellPositionUtils')\n], CellPositionUtils);\nexport { CellPositionUtils };\n","export class UndoRedoAction {\n constructor(cellValueChanges) {\n this.cellValueChanges = cellValueChanges;\n }\n}\nexport class RangeUndoRedoAction extends UndoRedoAction {\n constructor(cellValueChanges, initialRange, finalRange, ranges) {\n super(cellValueChanges);\n this.initialRange = initialRange;\n this.finalRange = finalRange;\n this.ranges = ranges;\n }\n}\nexport class UndoRedoStack {\n constructor(maxStackSize) {\n this.actionStack = [];\n this.maxStackSize = maxStackSize ? maxStackSize : UndoRedoStack.DEFAULT_STACK_SIZE;\n this.actionStack = new Array(this.maxStackSize);\n }\n pop() {\n return this.actionStack.pop();\n }\n push(item) {\n const shouldAddActions = item.cellValueChanges && item.cellValueChanges.length > 0;\n if (!shouldAddActions) {\n return;\n }\n if (this.actionStack.length === this.maxStackSize) {\n this.actionStack.shift();\n }\n this.actionStack.push(item);\n }\n clear() {\n this.actionStack = [];\n }\n getCurrentStackSize() {\n return this.actionStack.length;\n }\n}\nUndoRedoStack.DEFAULT_STACK_SIZE = 10;\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, Optional, PostConstruct } from \"../context/context.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { RangeUndoRedoAction, UndoRedoAction, UndoRedoStack } from \"./undoRedoStack.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\nlet UndoRedoService = class UndoRedoService extends BeanStub {\n constructor() {\n super(...arguments);\n this.cellValueChanges = [];\n this.activeCellEdit = null;\n this.activeRowEdit = null;\n this.isPasting = false;\n this.isRangeInAction = false;\n this.onCellValueChanged = (event) => {\n const eventCell = { column: event.column, rowIndex: event.rowIndex, rowPinned: event.rowPinned };\n const isCellEditing = this.activeCellEdit !== null && this.cellPositionUtils.equals(this.activeCellEdit, eventCell);\n const isRowEditing = this.activeRowEdit !== null && this.rowPositionUtils.sameRow(this.activeRowEdit, eventCell);\n const shouldCaptureAction = isCellEditing || isRowEditing || this.isPasting || this.isRangeInAction;\n if (!shouldCaptureAction) {\n return;\n }\n const { rowPinned, rowIndex, column, oldValue, value } = event;\n const cellValueChange = {\n rowPinned,\n rowIndex: rowIndex,\n columnId: column.getColId(),\n newValue: value,\n oldValue\n };\n this.cellValueChanges.push(cellValueChange);\n };\n this.clearStacks = () => {\n this.undoStack.clear();\n this.redoStack.clear();\n };\n }\n init() {\n if (!this.gridOptionsService.is('undoRedoCellEditing')) {\n return;\n }\n const undoRedoLimit = this.gridOptionsService.getNum('undoRedoCellEditingLimit');\n if (undoRedoLimit <= 0) {\n return;\n }\n this.undoStack = new UndoRedoStack(undoRedoLimit);\n this.redoStack = new UndoRedoStack(undoRedoLimit);\n this.addRowEditingListeners();\n this.addCellEditingListeners();\n this.addPasteListeners();\n this.addFillListeners();\n this.addCellKeyListeners();\n this.addManagedListener(this.eventService, Events.EVENT_CELL_VALUE_CHANGED, this.onCellValueChanged);\n // undo / redo is restricted to actual editing so we clear the stacks when other operations are\n // performed that change the order of the row / cols.\n this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, e => {\n if (!e.keepUndoRedoStack) {\n this.clearStacks();\n }\n });\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, this.clearStacks);\n this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.clearStacks);\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, this.clearStacks);\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.clearStacks);\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, this.clearStacks);\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, this.clearStacks);\n this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, this.clearStacks);\n this.addManagedListener(this.eventService, Events.EVENT_ROW_DRAG_END, this.clearStacks);\n this.ctrlsService.whenReady(() => {\n this.gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();\n });\n }\n getCurrentUndoStackSize() {\n return this.undoStack ? this.undoStack.getCurrentStackSize() : 0;\n }\n getCurrentRedoStackSize() {\n return this.redoStack ? this.redoStack.getCurrentStackSize() : 0;\n }\n undo(source) {\n const startEvent = {\n type: Events.EVENT_UNDO_STARTED,\n source\n };\n this.eventService.dispatchEvent(startEvent);\n const operationPerformed = this.undoRedo(this.undoStack, this.redoStack, 'initialRange', 'oldValue', 'undo');\n const endEvent = {\n type: Events.EVENT_UNDO_ENDED,\n source,\n operationPerformed\n };\n this.eventService.dispatchEvent(endEvent);\n }\n redo(source) {\n const startEvent = {\n type: Events.EVENT_REDO_STARTED,\n source\n };\n this.eventService.dispatchEvent(startEvent);\n const operationPerformed = this.undoRedo(this.redoStack, this.undoStack, 'finalRange', 'newValue', 'redo');\n const endEvent = {\n type: Events.EVENT_REDO_ENDED,\n source,\n operationPerformed\n };\n this.eventService.dispatchEvent(endEvent);\n }\n undoRedo(undoRedoStack, opposingUndoRedoStack, rangeProperty, cellValueChangeProperty, source) {\n if (!undoRedoStack) {\n return false;\n }\n const undoRedoAction = undoRedoStack.pop();\n if (!undoRedoAction || !undoRedoAction.cellValueChanges) {\n return false;\n }\n this.processAction(undoRedoAction, (cellValueChange) => cellValueChange[cellValueChangeProperty], source);\n if (undoRedoAction instanceof RangeUndoRedoAction) {\n this.processRange(undoRedoAction.ranges || [undoRedoAction[rangeProperty]]);\n }\n else {\n this.processCell(undoRedoAction.cellValueChanges);\n }\n opposingUndoRedoStack.push(undoRedoAction);\n return true;\n }\n processAction(action, valueExtractor, source) {\n action.cellValueChanges.forEach(cellValueChange => {\n const { rowIndex, rowPinned, columnId } = cellValueChange;\n const rowPosition = { rowIndex, rowPinned };\n const currentRow = this.getRowNode(rowPosition);\n // checks if the row has been filtered out\n if (!currentRow.displayed) {\n return;\n }\n currentRow.setDataValue(columnId, valueExtractor(cellValueChange), source);\n });\n }\n processRange(ranges) {\n let lastFocusedCell;\n this.rangeService.removeAllCellRanges(true);\n ranges.forEach((range, idx) => {\n if (!range) {\n return;\n }\n const startRow = range.startRow;\n const endRow = range.endRow;\n if (idx === ranges.length - 1) {\n lastFocusedCell = {\n rowPinned: startRow.rowPinned,\n rowIndex: startRow.rowIndex,\n columnId: range.startColumn.getColId()\n };\n this.setLastFocusedCell(lastFocusedCell);\n }\n const cellRangeParams = {\n rowStartIndex: startRow.rowIndex,\n rowStartPinned: startRow.rowPinned,\n rowEndIndex: endRow.rowIndex,\n rowEndPinned: endRow.rowPinned,\n columnStart: range.startColumn,\n columns: range.columns\n };\n this.rangeService.addCellRange(cellRangeParams);\n });\n }\n processCell(cellValueChanges) {\n const cellValueChange = cellValueChanges[0];\n const { rowIndex, rowPinned } = cellValueChange;\n const rowPosition = { rowIndex, rowPinned };\n const row = this.getRowNode(rowPosition);\n const lastFocusedCell = {\n rowPinned: cellValueChange.rowPinned,\n rowIndex: row.rowIndex,\n columnId: cellValueChange.columnId\n };\n // when single cells are being processed, they should be considered\n // as ranges when the rangeService is present (singleCellRanges).\n // otherwise focus will be restore but the range will not.\n this.setLastFocusedCell(lastFocusedCell, !!this.rangeService);\n }\n setLastFocusedCell(lastFocusedCell, setRangeToCell) {\n const { rowIndex, columnId, rowPinned } = lastFocusedCell;\n const scrollFeature = this.gridBodyCtrl.getScrollFeature();\n const column = this.columnModel.getGridColumn(columnId);\n if (!column) {\n return;\n }\n scrollFeature.ensureIndexVisible(rowIndex);\n scrollFeature.ensureColumnVisible(column);\n const cellPosition = { rowIndex, column, rowPinned };\n this.focusService.setFocusedCell(Object.assign(Object.assign({}, cellPosition), { forceBrowserFocus: true }));\n if (setRangeToCell) {\n this.rangeService.setRangeToCell(cellPosition);\n }\n }\n addRowEditingListeners() {\n this.addManagedListener(this.eventService, Events.EVENT_ROW_EDITING_STARTED, (e) => {\n this.activeRowEdit = { rowIndex: e.rowIndex, rowPinned: e.rowPinned };\n });\n this.addManagedListener(this.eventService, Events.EVENT_ROW_EDITING_STOPPED, () => {\n const action = new UndoRedoAction(this.cellValueChanges);\n this.pushActionsToUndoStack(action);\n this.activeRowEdit = null;\n });\n }\n addCellEditingListeners() {\n this.addManagedListener(this.eventService, Events.EVENT_CELL_EDITING_STARTED, (e) => {\n this.activeCellEdit = { column: e.column, rowIndex: e.rowIndex, rowPinned: e.rowPinned };\n });\n this.addManagedListener(this.eventService, Events.EVENT_CELL_EDITING_STOPPED, (e) => {\n this.activeCellEdit = null;\n const shouldPushAction = e.valueChanged && !this.activeRowEdit && !this.isPasting && !this.isRangeInAction;\n if (shouldPushAction) {\n const action = new UndoRedoAction(this.cellValueChanges);\n this.pushActionsToUndoStack(action);\n }\n });\n }\n addPasteListeners() {\n this.addManagedListener(this.eventService, Events.EVENT_PASTE_START, () => {\n this.isPasting = true;\n });\n this.addManagedListener(this.eventService, Events.EVENT_PASTE_END, () => {\n const action = new UndoRedoAction(this.cellValueChanges);\n this.pushActionsToUndoStack(action);\n this.isPasting = false;\n });\n }\n addFillListeners() {\n this.addManagedListener(this.eventService, Events.EVENT_FILL_START, () => {\n this.isRangeInAction = true;\n });\n this.addManagedListener(this.eventService, Events.EVENT_FILL_END, (event) => {\n const action = new RangeUndoRedoAction(this.cellValueChanges, event.initialRange, event.finalRange);\n this.pushActionsToUndoStack(action);\n this.isRangeInAction = false;\n });\n }\n addCellKeyListeners() {\n this.addManagedListener(this.eventService, Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_START, () => {\n this.isRangeInAction = true;\n });\n this.addManagedListener(this.eventService, Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_END, () => {\n let action;\n if (this.rangeService && this.gridOptionsService.isEnableRangeSelection()) {\n action = new RangeUndoRedoAction(this.cellValueChanges, undefined, undefined, [...this.rangeService.getCellRanges()]);\n }\n else {\n action = new UndoRedoAction(this.cellValueChanges);\n }\n this.pushActionsToUndoStack(action);\n this.isRangeInAction = false;\n });\n }\n pushActionsToUndoStack(action) {\n this.undoStack.push(action);\n this.cellValueChanges = [];\n this.redoStack.clear();\n }\n getRowNode(gridRow) {\n switch (gridRow.rowPinned) {\n case 'top':\n return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];\n case 'bottom':\n return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];\n default:\n return this.rowModel.getRow(gridRow.rowIndex);\n }\n }\n};\n__decorate([\n Autowired('focusService')\n], UndoRedoService.prototype, \"focusService\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], UndoRedoService.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('rowModel')\n], UndoRedoService.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('pinnedRowModel')\n], UndoRedoService.prototype, \"pinnedRowModel\", void 0);\n__decorate([\n Autowired('cellPositionUtils')\n], UndoRedoService.prototype, \"cellPositionUtils\", void 0);\n__decorate([\n Autowired('rowPositionUtils')\n], UndoRedoService.prototype, \"rowPositionUtils\", void 0);\n__decorate([\n Autowired('columnModel')\n], UndoRedoService.prototype, \"columnModel\", void 0);\n__decorate([\n Optional('rangeService')\n], UndoRedoService.prototype, \"rangeService\", void 0);\n__decorate([\n PostConstruct\n], UndoRedoService.prototype, \"init\", null);\nUndoRedoService = __decorate([\n Bean('undoRedoService')\n], UndoRedoService);\nexport { UndoRedoService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean } from \"../../context/context.mjs\";\nimport { BeanStub } from \"../../context/beanStub.mjs\";\nimport { ColumnGroup } from \"../../entities/columnGroup.mjs\";\nimport { HeaderRowType } from \"../row/headerRowComp.mjs\";\nimport { last } from \"../../utils/array.mjs\";\nlet HeaderPositionUtils = class HeaderPositionUtils extends BeanStub {\n findHeader(focusedHeader, direction) {\n let nextColumn;\n let getGroupMethod;\n let getColMethod;\n if (focusedHeader.column instanceof ColumnGroup) {\n getGroupMethod = `getDisplayedGroup${direction}`;\n nextColumn = this.columnModel[getGroupMethod](focusedHeader.column);\n }\n else {\n getColMethod = `getDisplayedCol${direction}`;\n nextColumn = this.columnModel[getColMethod](focusedHeader.column);\n }\n if (!nextColumn) {\n return;\n }\n let { headerRowIndex } = focusedHeader;\n const currentRowType = this.getHeaderRowType(headerRowIndex);\n if (currentRowType === HeaderRowType.COLUMN_GROUP) {\n const columnGroup = nextColumn;\n if (columnGroup.isPadding() && this.isAnyChildSpanningHeaderHeight(columnGroup)) {\n const { nextFocusColumn, nextRow } = this.getColumnVisibleChild(columnGroup, headerRowIndex, direction);\n if (nextFocusColumn) {\n nextColumn = nextFocusColumn;\n headerRowIndex = nextRow;\n }\n }\n }\n return {\n column: nextColumn,\n headerRowIndex\n };\n }\n isAnyChildSpanningHeaderHeight(columnGroup) {\n if (!columnGroup) {\n return false;\n }\n return columnGroup.getLeafColumns().some(col => col.isSpanHeaderHeight());\n }\n getColumnVisibleParent(currentColumn, currentIndex) {\n const currentRowType = this.getHeaderRowType(currentIndex);\n const isFloatingFilter = currentRowType === HeaderRowType.FLOATING_FILTER;\n const isColumn = currentRowType === HeaderRowType.COLUMN;\n let nextFocusColumn = isFloatingFilter ? currentColumn : currentColumn.getParent();\n let nextRow = currentIndex - 1;\n if (isColumn && this.isAnyChildSpanningHeaderHeight(currentColumn.getParent())) {\n while (nextFocusColumn && nextFocusColumn.isPadding()) {\n nextFocusColumn = nextFocusColumn.getParent();\n nextRow--;\n }\n if (nextRow < 0) {\n nextFocusColumn = currentColumn;\n nextRow = currentIndex;\n }\n }\n return { nextFocusColumn: nextFocusColumn, nextRow };\n }\n getColumnVisibleChild(column, currentIndex, direction = 'After') {\n const currentRowType = this.getHeaderRowType(currentIndex);\n let nextFocusColumn = column;\n let nextRow = currentIndex + 1;\n if (currentRowType === HeaderRowType.COLUMN_GROUP) {\n const leafColumns = column.getLeafColumns();\n const leafChild = direction === 'After' ? leafColumns[0] : last(leafColumns);\n if (this.isAnyChildSpanningHeaderHeight(leafChild.getParent())) {\n nextFocusColumn = leafChild;\n let currentColumn = leafChild.getParent();\n while (currentColumn && currentColumn !== column) {\n currentColumn = currentColumn.getParent();\n nextRow++;\n }\n }\n else {\n nextFocusColumn = column.getDisplayedChildren()[0];\n }\n }\n return { nextFocusColumn, nextRow };\n }\n getHeaderRowType(rowIndex) {\n const centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();\n if (centerHeaderContainer) {\n return centerHeaderContainer.getRowType(rowIndex);\n }\n }\n findColAtEdgeForHeaderRow(level, position) {\n const displayedColumns = this.columnModel.getAllDisplayedColumns();\n const column = displayedColumns[position === 'start' ? 0 : displayedColumns.length - 1];\n if (!column) {\n return;\n }\n const childContainer = this.ctrlsService.getHeaderRowContainerCtrl(column.getPinned());\n const type = childContainer.getRowType(level);\n if (type == HeaderRowType.COLUMN_GROUP) {\n const columnGroup = this.columnModel.getColumnGroupAtLevel(column, level);\n return {\n headerRowIndex: level,\n column: columnGroup\n };\n }\n return {\n // if type==null, means the header level didn't exist\n headerRowIndex: type == null ? -1 : level,\n column\n };\n }\n};\n__decorate([\n Autowired('columnModel')\n], HeaderPositionUtils.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], HeaderPositionUtils.prototype, \"ctrlsService\", void 0);\nHeaderPositionUtils = __decorate([\n Bean('headerPositionUtils')\n], HeaderPositionUtils);\nexport { HeaderPositionUtils };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean } from \"../context/context.mjs\";\nimport { deepCloneDefinition } from \"../utils/object.mjs\";\nlet ColumnDefFactory = class ColumnDefFactory {\n buildColumnDefs(cols, rowGroupColumns, pivotColumns) {\n const res = [];\n const colGroupDefs = {};\n cols.forEach(col => {\n const colDef = this.createDefFromColumn(col, rowGroupColumns, pivotColumns);\n let addToResult = true;\n let childDef = colDef;\n let pointer = col.getOriginalParent();\n let lastPointer = null;\n while (pointer) {\n let parentDef = null;\n // we don't include padding groups, as the column groups provided\n // by application didn't have these. the whole point of padding groups\n // is to balance the column tree that the user provided.\n if (pointer.isPadding()) {\n pointer = pointer.getOriginalParent();\n continue;\n }\n // if colDef for this group already exists, use it\n const existingParentDef = colGroupDefs[pointer.getGroupId()];\n if (existingParentDef) {\n existingParentDef.children.push(childDef);\n // if we added to result, it would be the second time we did it\n addToResult = false;\n // we don't want to continue up the tree, as it has already been\n // done for this group\n break;\n }\n parentDef = this.createDefFromGroup(pointer);\n if (parentDef) {\n parentDef.children = [childDef];\n colGroupDefs[parentDef.groupId] = parentDef;\n childDef = parentDef;\n pointer = pointer.getOriginalParent();\n }\n if (pointer != null && lastPointer === pointer) {\n addToResult = false;\n break;\n }\n // Ensure we don't get stuck in an infinite loop\n lastPointer = pointer;\n }\n if (addToResult) {\n res.push(childDef);\n }\n });\n return res;\n }\n createDefFromGroup(group) {\n const defCloned = deepCloneDefinition(group.getColGroupDef(), ['children']);\n if (defCloned) {\n defCloned.groupId = group.getGroupId();\n }\n return defCloned;\n }\n createDefFromColumn(col, rowGroupColumns, pivotColumns) {\n const colDefCloned = deepCloneDefinition(col.getColDef());\n colDefCloned.colId = col.getColId();\n colDefCloned.width = col.getActualWidth();\n colDefCloned.rowGroup = col.isRowGroupActive();\n colDefCloned.rowGroupIndex = col.isRowGroupActive() ? rowGroupColumns.indexOf(col) : null;\n colDefCloned.pivot = col.isPivotActive();\n colDefCloned.pivotIndex = col.isPivotActive() ? pivotColumns.indexOf(col) : null;\n colDefCloned.aggFunc = col.isValueActive() ? col.getAggFunc() : null;\n colDefCloned.hide = col.isVisible() ? undefined : true;\n colDefCloned.pinned = col.isPinned() ? col.getPinned() : null;\n colDefCloned.sort = col.getSort() ? col.getSort() : null;\n colDefCloned.sortIndex = col.getSortIndex() != null ? col.getSortIndex() : null;\n return colDefCloned;\n }\n};\nColumnDefFactory = __decorate([\n Bean('columnDefFactory')\n], ColumnDefFactory);\nexport { ColumnDefFactory };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { exists } from \"../../utils/generic.mjs\";\nimport { pushAll } from \"../../utils/array.mjs\";\nimport { Autowired, Bean } from \"../../context/context.mjs\";\nlet RowCssClassCalculator = class RowCssClassCalculator {\n getInitialRowClasses(params) {\n const classes = [];\n if (exists(params.extraCssClass)) {\n classes.push(params.extraCssClass);\n }\n classes.push('ag-row');\n classes.push(params.rowFocused ? 'ag-row-focus' : 'ag-row-no-focus');\n if (params.fadeRowIn) {\n classes.push('ag-opacity-zero');\n }\n classes.push(params.rowIsEven ? 'ag-row-even' : 'ag-row-odd');\n if (params.rowNode.isRowPinned()) {\n classes.push('ag-row-pinned');\n }\n if (params.rowNode.isSelected()) {\n classes.push('ag-row-selected');\n }\n if (params.rowNode.footer) {\n classes.push('ag-row-footer');\n }\n classes.push('ag-row-level-' + params.rowLevel);\n if (params.rowNode.stub) {\n classes.push('ag-row-loading');\n }\n if (params.fullWidthRow) {\n classes.push('ag-full-width-row');\n }\n if (params.expandable) {\n classes.push('ag-row-group');\n classes.push(params.rowNode.expanded ? 'ag-row-group-expanded' : 'ag-row-group-contracted');\n }\n if (params.rowNode.dragging) {\n classes.push('ag-row-dragging');\n }\n pushAll(classes, this.processClassesFromGridOptions(params.rowNode));\n pushAll(classes, this.preProcessRowClassRules(params.rowNode));\n // we use absolute position unless we are doing print layout\n classes.push(params.printLayout ? 'ag-row-position-relative' : 'ag-row-position-absolute');\n if (params.firstRowOnPage) {\n classes.push('ag-row-first');\n }\n if (params.lastRowOnPage) {\n classes.push('ag-row-last');\n }\n if (params.fullWidthRow) {\n if (params.pinned === 'left') {\n classes.push('ag-cell-last-left-pinned');\n }\n if (params.pinned === 'right') {\n classes.push('ag-cell-first-right-pinned');\n }\n }\n return classes;\n }\n processClassesFromGridOptions(rowNode) {\n const res = [];\n const process = (rowCls) => {\n if (typeof rowCls === 'string') {\n res.push(rowCls);\n }\n else if (Array.isArray(rowCls)) {\n rowCls.forEach(e => res.push(e));\n }\n };\n // part 1 - rowClass\n const rowClass = this.gridOptionsService.get('rowClass');\n if (rowClass) {\n if (typeof rowClass === 'function') {\n console.warn('AG Grid: rowClass should not be a function, please use getRowClass instead');\n return [];\n }\n process(rowClass);\n }\n // part 2 - rowClassFunc\n const rowClassFunc = this.gridOptionsService.getCallback('getRowClass');\n if (rowClassFunc) {\n const params = {\n data: rowNode.data,\n node: rowNode,\n rowIndex: rowNode.rowIndex\n };\n const rowClassFuncResult = rowClassFunc(params);\n process(rowClassFuncResult);\n }\n return res;\n }\n preProcessRowClassRules(rowNode) {\n const res = [];\n this.processRowClassRules(rowNode, (className) => {\n res.push(className);\n }, (className) => {\n // not catered for, if creating, no need\n // to remove class as it was never there\n });\n return res;\n }\n processRowClassRules(rowNode, onApplicableClass, onNotApplicableClass) {\n const rowClassParams = {\n data: rowNode.data,\n node: rowNode,\n rowIndex: rowNode.rowIndex,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context\n };\n this.stylingService.processClassRules(this.gridOptionsService.get('rowClassRules'), rowClassParams, onApplicableClass, onNotApplicableClass);\n }\n calculateRowLevel(rowNode) {\n if (rowNode.group) {\n return rowNode.level;\n }\n // if a leaf, and a parent exists, put a level of the parent, else put level of 0 for top level item\n return rowNode.parent ? (rowNode.parent.level + 1) : 0;\n }\n};\n__decorate([\n Autowired('stylingService')\n], RowCssClassCalculator.prototype, \"stylingService\", void 0);\n__decorate([\n Autowired('gridOptionsService')\n], RowCssClassCalculator.prototype, \"gridOptionsService\", void 0);\nRowCssClassCalculator = __decorate([\n Bean('rowCssClassCalculator')\n], RowCssClassCalculator);\nexport { RowCssClassCalculator };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { _ } from \"../utils/index.mjs\";\nimport { BeanStub } from \"../context/beanStub.mjs\";\n// this logic is used by both SSRM and CSRM\nlet RowNodeSorter = class RowNodeSorter extends BeanStub {\n init() {\n this.isAccentedSort = this.gridOptionsService.is('accentedSort');\n this.primaryColumnsSortGroups = this.gridOptionsService.isColumnsSortingCoupledToGroup();\n this.addManagedPropertyListener('accentedSort', (propChange) => this.isAccentedSort = propChange.currentValue);\n this.addManagedPropertyListener('autoGroupColumnDef', () => this.primaryColumnsSortGroups = this.gridOptionsService.isColumnsSortingCoupledToGroup());\n }\n doFullSort(rowNodes, sortOptions) {\n const mapper = (rowNode, pos) => ({ currentPos: pos, rowNode: rowNode });\n const sortedRowNodes = rowNodes.map(mapper);\n sortedRowNodes.sort(this.compareRowNodes.bind(this, sortOptions));\n return sortedRowNodes.map(item => item.rowNode);\n }\n compareRowNodes(sortOptions, sortedNodeA, sortedNodeB) {\n const nodeA = sortedNodeA.rowNode;\n const nodeB = sortedNodeB.rowNode;\n // Iterate columns, return the first that doesn't match\n for (let i = 0, len = sortOptions.length; i < len; i++) {\n const sortOption = sortOptions[i];\n const isDescending = sortOption.sort === 'desc';\n const valueA = this.getValue(nodeA, sortOption.column);\n const valueB = this.getValue(nodeB, sortOption.column);\n let comparatorResult;\n const providedComparator = this.getComparator(sortOption, nodeA);\n if (providedComparator) {\n //if comparator provided, use it\n comparatorResult = providedComparator(valueA, valueB, nodeA, nodeB, isDescending);\n }\n else {\n //otherwise do our own comparison\n comparatorResult = _.defaultComparator(valueA, valueB, this.isAccentedSort);\n }\n // user provided comparators can return 'NaN' if they don't correctly handle 'undefined' values, this\n // typically occurs when the comparator is used on a group row\n const validResult = !isNaN(comparatorResult);\n if (validResult && comparatorResult !== 0) {\n return sortOption.sort === 'asc' ? comparatorResult : comparatorResult * -1;\n }\n }\n // All matched, we make is so that the original sort order is kept:\n return sortedNodeA.currentPos - sortedNodeB.currentPos;\n }\n getComparator(sortOption, rowNode) {\n const column = sortOption.column;\n // comparator on col get preference over everything else\n const comparatorOnCol = column.getColDef().comparator;\n if (comparatorOnCol != null) {\n return comparatorOnCol;\n }\n if (!column.getColDef().showRowGroup) {\n return;\n }\n // if a 'field' is supplied on the autoGroupColumnDef we need to use the associated column comparator\n const groupLeafField = !rowNode.group && column.getColDef().field;\n if (!groupLeafField) {\n return;\n }\n const primaryColumn = this.columnModel.getPrimaryColumn(groupLeafField);\n if (!primaryColumn) {\n return;\n }\n return primaryColumn.getColDef().comparator;\n }\n getValue(node, column) {\n var _a, _b;\n if (!this.primaryColumnsSortGroups) {\n return this.valueService.getValue(column, node, false, false);\n }\n const isNodeGroupedAtLevel = node.rowGroupColumn === column;\n if (isNodeGroupedAtLevel) {\n const isGroupRows = this.gridOptionsService.isGroupUseEntireRow(this.columnModel.isPivotActive());\n if (isGroupRows) {\n // if the column has a provided a keyCreator, we have to use the key, as the group could be\n // irrelevant to the column value\n const keyCreator = column.getColDef().keyCreator;\n if (keyCreator) {\n return node.key;\n }\n // if the group was generated from the column data, all the leaf children should return the same\n // value\n const leafChild = (_a = node.allLeafChildren) === null || _a === void 0 ? void 0 : _a[0];\n if (leafChild) {\n return this.valueService.getValue(column, leafChild, false, false);\n }\n return undefined;\n }\n const displayCol = this.columnModel.getGroupDisplayColumnForGroup(column.getId());\n if (!displayCol) {\n return undefined;\n }\n return (_b = node.groupData) === null || _b === void 0 ? void 0 : _b[displayCol.getId()];\n }\n if (node.group && column.getColDef().showRowGroup) {\n return undefined;\n }\n return this.valueService.getValue(column, node, false, false);\n }\n};\n__decorate([\n Autowired('valueService')\n], RowNodeSorter.prototype, \"valueService\", void 0);\n__decorate([\n Autowired('columnModel')\n], RowNodeSorter.prototype, \"columnModel\", void 0);\n__decorate([\n PostConstruct\n], RowNodeSorter.prototype, \"init\", null);\nRowNodeSorter = __decorate([\n Bean('rowNodeSorter')\n], RowNodeSorter);\nexport { RowNodeSorter };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar CtrlsService_1;\nimport { Bean } from \"./context/context.mjs\";\nimport { BeanStub } from \"./context/beanStub.mjs\";\nlet CtrlsService = CtrlsService_1 = class CtrlsService extends BeanStub {\n constructor() {\n super(...arguments);\n this.ready = false;\n this.readyCallbacks = [];\n }\n checkReady() {\n this.ready =\n this.gridCtrl != null\n && this.gridBodyCtrl != null\n && this.centerRowContainerCtrl != null\n && this.leftRowContainerCtrl != null\n && this.rightRowContainerCtrl != null\n && this.bottomCenterRowContainerCtrl != null\n && this.bottomLeftRowContainerCtrl != null\n && this.bottomRightRowContainerCtrl != null\n && this.topCenterRowContainerCtrl != null\n && this.topLeftRowContainerCtrl != null\n && this.topRightRowContainerCtrl != null\n && this.stickyTopCenterRowContainerCtrl != null\n && this.stickyTopLeftRowContainerCtrl != null\n && this.stickyTopRightRowContainerCtrl != null\n && this.centerHeaderRowContainerCtrl != null\n && this.leftHeaderRowContainerCtrl != null\n && this.rightHeaderRowContainerCtrl != null\n && this.fakeHScrollComp != null\n && this.fakeVScrollComp != null\n && this.gridHeaderCtrl != null;\n if (this.ready) {\n const p = this.createReadyParams();\n this.readyCallbacks.forEach(c => c(p));\n this.readyCallbacks.length = 0;\n }\n }\n whenReady(callback) {\n if (this.ready) {\n callback(this.createReadyParams());\n }\n else {\n this.readyCallbacks.push(callback);\n }\n }\n createReadyParams() {\n return {\n centerRowContainerCtrl: this.centerRowContainerCtrl,\n leftRowContainerCtrl: this.leftRowContainerCtrl,\n rightRowContainerCtrl: this.rightRowContainerCtrl,\n bottomCenterRowContainerCtrl: this.bottomCenterRowContainerCtrl,\n bottomLeftRowContainerCtrl: this.bottomLeftRowContainerCtrl,\n bottomRightRowContainerCtrl: this.bottomRightRowContainerCtrl,\n topCenterRowContainerCtrl: this.topCenterRowContainerCtrl,\n topLeftRowContainerCtrl: this.topLeftRowContainerCtrl,\n topRightRowContainerCtrl: this.topRightRowContainerCtrl,\n stickyTopCenterRowContainerCtrl: this.stickyTopCenterRowContainerCtrl,\n stickyTopLeftRowContainerCtrl: this.stickyTopLeftRowContainerCtrl,\n stickyTopRightRowContainerCtrl: this.stickyTopRightRowContainerCtrl,\n centerHeaderRowContainerCtrl: this.centerHeaderRowContainerCtrl,\n leftHeaderRowContainerCtrl: this.leftHeaderRowContainerCtrl,\n rightHeaderRowContainerCtrl: this.rightHeaderRowContainerCtrl,\n fakeHScrollComp: this.fakeHScrollComp,\n fakeVScrollComp: this.fakeVScrollComp,\n gridBodyCtrl: this.gridBodyCtrl,\n gridCtrl: this.gridCtrl,\n gridHeaderCtrl: this.gridHeaderCtrl,\n };\n }\n registerFakeHScrollComp(comp) {\n this.fakeHScrollComp = comp;\n this.checkReady();\n }\n registerFakeVScrollComp(comp) {\n this.fakeVScrollComp = comp;\n this.checkReady();\n }\n registerGridHeaderCtrl(gridHeaderCtrl) {\n this.gridHeaderCtrl = gridHeaderCtrl;\n this.checkReady();\n }\n registerCenterRowContainerCtrl(ctrl) {\n this.centerRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerLeftRowContainerCtrl(ctrl) {\n this.leftRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerRightRowContainerCtrl(ctrl) {\n this.rightRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerTopCenterRowContainerCtrl(ctrl) {\n this.topCenterRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerTopLeftRowContainerCon(ctrl) {\n this.topLeftRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerTopRightRowContainerCtrl(ctrl) {\n this.topRightRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerStickyTopCenterRowContainerCtrl(ctrl) {\n this.stickyTopCenterRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerStickyTopLeftRowContainerCon(ctrl) {\n this.stickyTopLeftRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerStickyTopRightRowContainerCtrl(ctrl) {\n this.stickyTopRightRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerBottomCenterRowContainerCtrl(ctrl) {\n this.bottomCenterRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerBottomLeftRowContainerCtrl(ctrl) {\n this.bottomLeftRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerBottomRightRowContainerCtrl(ctrl) {\n this.bottomRightRowContainerCtrl = ctrl;\n this.checkReady();\n }\n registerHeaderContainer(ctrl, pinned) {\n switch (pinned) {\n case 'left':\n this.leftHeaderRowContainerCtrl = ctrl;\n break;\n case 'right':\n this.rightHeaderRowContainerCtrl = ctrl;\n break;\n default:\n this.centerHeaderRowContainerCtrl = ctrl;\n break;\n }\n this.checkReady();\n }\n registerGridBodyCtrl(ctrl) {\n this.gridBodyCtrl = ctrl;\n this.checkReady();\n }\n registerGridCtrl(ctrl) {\n this.gridCtrl = ctrl;\n this.checkReady();\n }\n getFakeHScrollComp() {\n return this.fakeHScrollComp;\n }\n getFakeVScrollComp() {\n return this.fakeVScrollComp;\n }\n getGridHeaderCtrl() {\n return this.gridHeaderCtrl;\n }\n getGridCtrl() {\n return this.gridCtrl;\n }\n getCenterRowContainerCtrl() {\n return this.centerRowContainerCtrl;\n }\n getTopCenterRowContainerCtrl() {\n return this.topCenterRowContainerCtrl;\n }\n getBottomCenterRowContainerCtrl() {\n return this.bottomCenterRowContainerCtrl;\n }\n getStickyTopCenterRowContainerCtrl() {\n return this.stickyTopCenterRowContainerCtrl;\n }\n getGridBodyCtrl() {\n return this.gridBodyCtrl;\n }\n getHeaderRowContainerCtrls() {\n return [this.leftHeaderRowContainerCtrl, this.rightHeaderRowContainerCtrl, this.centerHeaderRowContainerCtrl];\n }\n getHeaderRowContainerCtrl(pinned) {\n switch (pinned) {\n case 'left': return this.leftHeaderRowContainerCtrl;\n case 'right': return this.rightHeaderRowContainerCtrl;\n default: return this.centerHeaderRowContainerCtrl;\n }\n }\n};\nCtrlsService.NAME = 'ctrlsService';\nCtrlsService = CtrlsService_1 = __decorate([\n Bean(CtrlsService_1.NAME)\n], CtrlsService);\nexport { CtrlsService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"./context/beanStub.mjs\";\nimport { Bean } from \"./context/context.mjs\";\nlet CtrlsFactory = class CtrlsFactory extends BeanStub {\n constructor() {\n super(...arguments);\n this.registry = {};\n }\n register(meta) {\n this.registry[meta.controllerName] = meta.controllerClass;\n }\n getInstance(name) {\n const ControllerClass = this.registry[name];\n if (ControllerClass == null) {\n return undefined;\n }\n return new ControllerClass();\n }\n};\nCtrlsFactory = __decorate([\n Bean('ctrlsFactory')\n], CtrlsFactory);\nexport { CtrlsFactory };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired } from \"../context/context.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { isInvisibleScrollbar, isIOSUserAgent, isMacOsUserAgent } from \"../utils/browser.mjs\";\nimport { isVisible } from \"../utils/dom.mjs\";\nimport { waitUntil } from \"../utils/function.mjs\";\nimport { Component } from \"../widgets/component.mjs\";\nimport { RefSelector } from \"../widgets/componentAnnotations.mjs\";\nexport class AbstractFakeScrollComp extends Component {\n constructor(template, direction) {\n super(template);\n this.direction = direction;\n this.hideTimeout = null;\n }\n postConstruct() {\n this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, this.onScrollVisibilityChanged.bind(this));\n this.onScrollVisibilityChanged();\n this.addOrRemoveCssClass('ag-apple-scrollbar', isMacOsUserAgent() || isIOSUserAgent());\n }\n initialiseInvisibleScrollbar() {\n if (this.invisibleScrollbar !== undefined) {\n return;\n }\n this.invisibleScrollbar = isInvisibleScrollbar();\n if (this.invisibleScrollbar) {\n this.hideAndShowInvisibleScrollAsNeeded();\n this.addActiveListenerToggles();\n }\n }\n addActiveListenerToggles() {\n const activateEvents = ['mouseenter', 'mousedown', 'touchstart'];\n const deactivateEvents = ['mouseleave', 'touchend'];\n const eGui = this.getGui();\n activateEvents.forEach(eventName => this.addManagedListener(eGui, eventName, () => this.addOrRemoveCssClass('ag-scrollbar-active', true)));\n deactivateEvents.forEach(eventName => this.addManagedListener(eGui, eventName, () => this.addOrRemoveCssClass('ag-scrollbar-active', false)));\n }\n onScrollVisibilityChanged() {\n // initialiseInvisibleScrollbar should only be called once, but the reason\n // this can't be inside `setComp` or `PostConstruct` is the DOM might not\n // be ready, so we call it until eventually, it gets calculated.\n if (this.invisibleScrollbar === undefined) {\n this.initialiseInvisibleScrollbar();\n }\n this.animationFrameService.requestAnimationFrame(() => this.setScrollVisible());\n }\n hideAndShowInvisibleScrollAsNeeded() {\n this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, (params) => {\n if (params.direction === this.direction) {\n if (this.hideTimeout !== null) {\n window.clearTimeout(this.hideTimeout);\n this.hideTimeout = null;\n }\n this.addOrRemoveCssClass('ag-scrollbar-scrolling', true);\n }\n });\n this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL_END, () => {\n this.hideTimeout = window.setTimeout(() => {\n this.addOrRemoveCssClass('ag-scrollbar-scrolling', false);\n this.hideTimeout = null;\n }, 400);\n });\n }\n attemptSettingScrollPosition(value) {\n const viewport = this.getViewport();\n waitUntil(() => isVisible(viewport), () => this.setScrollPosition(value), 100);\n }\n getViewport() {\n return this.eViewport;\n }\n getContainer() {\n return this.eContainer;\n }\n onScrollCallback(fn) {\n this.addManagedListener(this.getViewport(), 'scroll', fn);\n }\n}\n__decorate([\n RefSelector('eViewport')\n], AbstractFakeScrollComp.prototype, \"eViewport\", void 0);\n__decorate([\n RefSelector('eContainer')\n], AbstractFakeScrollComp.prototype, \"eContainer\", void 0);\n__decorate([\n Autowired('scrollVisibleService')\n], AbstractFakeScrollComp.prototype, \"scrollVisibleService\", void 0);\n__decorate([\n Autowired('ctrlsService')\n], AbstractFakeScrollComp.prototype, \"ctrlsService\", void 0);\n__decorate([\n Autowired('animationFrameService')\n], AbstractFakeScrollComp.prototype, \"animationFrameService\", void 0);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, PostConstruct } from \"../context/context.mjs\";\nimport { AbstractFakeScrollComp } from \"./abstractFakeScrollComp.mjs\";\nimport { getScrollLeft, isVisible, setFixedHeight, setFixedWidth, setScrollLeft } from \"../utils/dom.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nimport { RefSelector } from \"../widgets/componentAnnotations.mjs\";\nimport { CenterWidthFeature } from \"./centerWidthFeature.mjs\";\nexport class FakeHScrollComp extends AbstractFakeScrollComp {\n constructor() {\n super(FakeHScrollComp.TEMPLATE, 'horizontal');\n }\n postConstruct() {\n super.postConstruct();\n // When doing printing, this changes whether cols are pinned or not\n const spacerWidthsListener = this.setFakeHScrollSpacerWidths.bind(this);\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, spacerWidthsListener);\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, spacerWidthsListener);\n this.addManagedListener(this.eventService, Events.EVENT_PINNED_ROW_DATA_CHANGED, this.onPinnedRowDataChanged.bind(this));\n this.addManagedPropertyListener('domLayout', spacerWidthsListener);\n this.ctrlsService.registerFakeHScrollComp(this);\n this.createManagedBean(new CenterWidthFeature(width => this.eContainer.style.width = `${width}px`));\n }\n initialiseInvisibleScrollbar() {\n if (this.invisibleScrollbar !== undefined) {\n return;\n }\n this.enableRtl = this.gridOptionsService.is('enableRtl');\n super.initialiseInvisibleScrollbar();\n if (this.invisibleScrollbar) {\n this.refreshCompBottom();\n }\n }\n onPinnedRowDataChanged() {\n this.refreshCompBottom();\n }\n refreshCompBottom() {\n if (!this.invisibleScrollbar) {\n return;\n }\n const bottomPinnedHeight = this.pinnedRowModel.getPinnedBottomTotalHeight();\n this.getGui().style.bottom = `${bottomPinnedHeight}px`;\n }\n onScrollVisibilityChanged() {\n super.onScrollVisibilityChanged();\n this.setFakeHScrollSpacerWidths();\n }\n setFakeHScrollSpacerWidths() {\n const vScrollShowing = this.scrollVisibleService.isVerticalScrollShowing();\n // we pad the right based on a) if cols are pinned to the right and\n // b) if v scroll is showing on the right (normal position of scroll)\n let rightSpacing = this.columnModel.getDisplayedColumnsRightWidth();\n const scrollOnRight = !this.enableRtl && vScrollShowing;\n const scrollbarWidth = this.gridOptionsService.getScrollbarWidth();\n if (scrollOnRight) {\n rightSpacing += scrollbarWidth;\n }\n setFixedWidth(this.eRightSpacer, rightSpacing);\n this.eRightSpacer.classList.toggle('ag-scroller-corner', rightSpacing <= scrollbarWidth);\n // we pad the left based on a) if cols are pinned to the left and\n // b) if v scroll is showing on the left (happens in LTR layout only)\n let leftSpacing = this.columnModel.getDisplayedColumnsLeftWidth();\n const scrollOnLeft = this.enableRtl && vScrollShowing;\n if (scrollOnLeft) {\n leftSpacing += scrollbarWidth;\n }\n setFixedWidth(this.eLeftSpacer, leftSpacing);\n this.eLeftSpacer.classList.toggle('ag-scroller-corner', leftSpacing <= scrollbarWidth);\n }\n setScrollVisible() {\n const hScrollShowing = this.scrollVisibleService.isHorizontalScrollShowing();\n const invisibleScrollbar = this.invisibleScrollbar;\n const isSuppressHorizontalScroll = this.gridOptionsService.is('suppressHorizontalScroll');\n const scrollbarWidth = hScrollShowing ? (this.gridOptionsService.getScrollbarWidth() || 0) : 0;\n const adjustedScrollbarWidth = (scrollbarWidth === 0 && invisibleScrollbar) ? 16 : scrollbarWidth;\n const scrollContainerSize = !isSuppressHorizontalScroll ? adjustedScrollbarWidth : 0;\n this.addOrRemoveCssClass('ag-scrollbar-invisible', invisibleScrollbar);\n setFixedHeight(this.getGui(), scrollContainerSize);\n setFixedHeight(this.eViewport, scrollContainerSize);\n setFixedHeight(this.eContainer, scrollContainerSize);\n this.setDisplayed(hScrollShowing, { skipAriaHidden: true });\n }\n getScrollPosition() {\n return getScrollLeft(this.getViewport(), this.enableRtl);\n }\n setScrollPosition(value) {\n if (!isVisible(this.getViewport())) {\n this.attemptSettingScrollPosition(value);\n }\n setScrollLeft(this.getViewport(), value, this.enableRtl);\n }\n}\nFakeHScrollComp.TEMPLATE = `
\n
\n
\n
\n
\n
\n
`;\n__decorate([\n RefSelector('eLeftSpacer')\n], FakeHScrollComp.prototype, \"eLeftSpacer\", void 0);\n__decorate([\n RefSelector('eRightSpacer')\n], FakeHScrollComp.prototype, \"eRightSpacer\", void 0);\n__decorate([\n Autowired('columnModel')\n], FakeHScrollComp.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('pinnedRowModel')\n], FakeHScrollComp.prototype, \"pinnedRowModel\", void 0);\n__decorate([\n PostConstruct\n], FakeHScrollComp.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nlet PinnedWidthService = class PinnedWidthService extends BeanStub {\n postConstruct() {\n const listener = this.checkContainerWidths.bind(this);\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);\n this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, listener);\n this.addManagedPropertyListener('domLayout', listener);\n }\n checkContainerWidths() {\n const printLayout = this.gridOptionsService.isDomLayout('print');\n const newLeftWidth = printLayout ? 0 : this.columnModel.getDisplayedColumnsLeftWidth();\n const newRightWidth = printLayout ? 0 : this.columnModel.getDisplayedColumnsRightWidth();\n if (newLeftWidth != this.leftWidth) {\n this.leftWidth = newLeftWidth;\n this.eventService.dispatchEvent({ type: Events.EVENT_LEFT_PINNED_WIDTH_CHANGED });\n }\n if (newRightWidth != this.rightWidth) {\n this.rightWidth = newRightWidth;\n this.eventService.dispatchEvent({ type: Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED });\n }\n }\n getPinnedRightWidth() {\n return this.rightWidth;\n }\n getPinnedLeftWidth() {\n return this.leftWidth;\n }\n};\n__decorate([\n Autowired('columnModel')\n], PinnedWidthService.prototype, \"columnModel\", void 0);\n__decorate([\n PostConstruct\n], PinnedWidthService.prototype, \"postConstruct\", null);\nPinnedWidthService = __decorate([\n Bean('pinnedWidthService')\n], PinnedWidthService);\nexport { PinnedWidthService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BeanStub } from \"../context/beanStub.mjs\";\nimport { Autowired, Bean, PostConstruct } from \"../context/context.mjs\";\nlet RowNodeEventThrottle = class RowNodeEventThrottle extends BeanStub {\n constructor() {\n super(...arguments);\n this.events = [];\n }\n postConstruct() {\n if (this.rowModel.getType() == 'clientSide') {\n this.clientSideRowModel = this.rowModel;\n }\n }\n // because the user can call rowNode.setExpanded() many times in one VM turn,\n // we throttle the calls to ClientSideRowModel using animationFrameService. this means for 100\n // row nodes getting expanded, we only update the CSRM once, and then we fire all events after\n // CSRM has updated.\n //\n // if we did not do this, then the user could call setExpanded on 100+ rows, causing the grid\n // to re-render 100+ times, which would be a performance lag.\n //\n // we use animationFrameService\n // rather than _.debounce() so this will get done if anyone flushes the animationFrameService\n // (eg user calls api.ensureRowVisible(), which in turn flushes ).\n dispatchExpanded(event) {\n // if not using CSRM, we don't debounce. otherwise this breaks the SSRM.\n if (this.clientSideRowModel == null) {\n this.eventService.dispatchEvent(event);\n return;\n }\n this.events.push(event);\n const func = () => {\n if (this.clientSideRowModel) {\n this.clientSideRowModel.onRowGroupOpened();\n }\n this.events.forEach(e => this.eventService.dispatchEvent(e));\n this.events = [];\n };\n if (this.dispatchExpandedDebounced == null) {\n this.dispatchExpandedDebounced = this.animationFrameService.debounce(func);\n }\n this.dispatchExpandedDebounced();\n }\n};\n__decorate([\n Autowired('animationFrameService')\n], RowNodeEventThrottle.prototype, \"animationFrameService\", void 0);\n__decorate([\n Autowired('rowModel')\n], RowNodeEventThrottle.prototype, \"rowModel\", void 0);\n__decorate([\n PostConstruct\n], RowNodeEventThrottle.prototype, \"postConstruct\", null);\nRowNodeEventThrottle = __decorate([\n Bean('rowNodeEventThrottle')\n], RowNodeEventThrottle);\nexport { RowNodeEventThrottle };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { ComponentUtil } from \"./components/componentUtil.mjs\";\nimport { Autowired, Bean, PostConstruct, PreDestroy, Qualifier } from \"./context/context.mjs\";\nimport { Events } from \"./events.mjs\";\nimport { EventService } from \"./eventService.mjs\";\nimport { doOnce } from \"./utils/function.mjs\";\nimport { exists, missing } from \"./utils/generic.mjs\";\nimport { getScrollbarWidth } from './utils/browser.mjs';\nimport { ModuleRegistry } from \"./modules/moduleRegistry.mjs\";\nimport { ModuleNames } from \"./modules/moduleNames.mjs\";\nimport { matchesGroupDisplayType } from \"./gridOptionsValidator.mjs\";\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (typeof value == 'string') {\n return parseInt(value, 10);\n }\n}\nfunction isTrue(value) {\n return value === true || value === 'true';\n}\nlet GridOptionsService = class GridOptionsService {\n constructor() {\n this.destroyed = false;\n this.domDataKey = '__AG_' + Math.random().toString();\n this.propertyEventService = new EventService();\n }\n // This is quicker then having code call gridOptionsService.get('context')\n get context() {\n return this.gridOptions['context'];\n }\n agWire(gridApi, columnApi) {\n this.gridOptions.api = gridApi;\n this.gridOptions.columnApi = columnApi;\n this.api = gridApi;\n this.columnApi = columnApi;\n }\n init() {\n this.gridOptionLookup = new Set([...ComponentUtil.ALL_PROPERTIES, ...ComponentUtil.EVENT_CALLBACKS]);\n const async = !this.is('suppressAsyncEvents');\n this.eventService.addGlobalListener(this.globalEventHandler.bind(this), async);\n // sets an initial calculation for the scrollbar width\n this.getScrollbarWidth();\n }\n destroy() {\n // need to remove these, as we don't own the lifecycle of the gridOptions, we need to\n // remove the references in case the user keeps the grid options, we want the rest\n // of the grid to be picked up by the garbage collector\n this.gridOptions.api = null;\n this.gridOptions.columnApi = null;\n this.destroyed = true;\n }\n /**\n * Is the given GridOption property set to true.\n * @param property GridOption property that has the type `boolean | undefined`\n */\n is(property) {\n return isTrue(this.gridOptions[property]);\n }\n /**\n * Get the raw value of the GridOptions property provided.\n * @param property\n */\n get(property) {\n return this.gridOptions[property];\n }\n /**\n * Get the GridOption property as a number, raw value is returned via a toNumber coercion function.\n * @param property GridOption property that has the type `number | undefined`\n */\n getNum(property) {\n return toNumber(this.gridOptions[property]);\n }\n /**\n * Get the GridOption callback but wrapped so that the common params of api,columnApi and context are automatically applied to the params.\n * @param property GridOption callback properties based on the fact that this property has a callback with params extending AgGridCommon\n */\n getCallback(property) {\n return this.mergeGridCommonParams(this.gridOptions[property]);\n }\n /**\n * Returns `true` if a value has been specified for this GridOption.\n * @param property GridOption property\n */\n exists(property) {\n return exists(this.gridOptions[property]);\n }\n /**\n * Wrap the user callback and attach the api, columnApi and context to the params object on the way through.\n * @param callback User provided callback\n * @returns Wrapped callback where the params object not require api, columnApi and context\n */\n mergeGridCommonParams(callback) {\n if (callback) {\n const wrapped = (callbackParams) => {\n const mergedParams = callbackParams;\n mergedParams.api = this.api;\n mergedParams.columnApi = this.columnApi;\n mergedParams.context = this.context;\n return callback(mergedParams);\n };\n return wrapped;\n }\n return callback;\n }\n /**\n *\n * @param key - key of the GridOption property to update\n * @param newValue - new value for this property\n * @param force - force the property change Event to be fired even if the value has not changed\n * @param eventParams - additional params to merge into the property changed event\n */\n set(key, newValue, force = false, eventParams = {}) {\n if (this.gridOptionLookup.has(key)) {\n const previousValue = this.gridOptions[key];\n if (force || previousValue !== newValue) {\n this.gridOptions[key] = newValue;\n const event = Object.assign({ type: key, currentValue: newValue, previousValue: previousValue }, eventParams);\n this.propertyEventService.dispatchEvent(event);\n }\n }\n }\n addEventListener(key, listener) {\n this.propertyEventService.addEventListener(key, listener);\n }\n removeEventListener(key, listener) {\n this.propertyEventService.removeEventListener(key, listener);\n }\n // responsible for calling the onXXX functions on gridOptions\n globalEventHandler(eventName, event) {\n // prevent events from being fired _after_ the grid has been destroyed\n if (this.destroyed) {\n return;\n }\n const callbackMethodName = ComponentUtil.getCallbackForEvent(eventName);\n if (typeof this.gridOptions[callbackMethodName] === 'function') {\n this.gridOptions[callbackMethodName](event);\n }\n }\n // *************** Helper methods ************************** //\n // Methods to share common GridOptions related logic that goes above accessing a single property\n getGridId() {\n return this.api.getGridId();\n }\n // the user might be using some non-standard scrollbar, eg a scrollbar that has zero\n // width and overlays (like the Safari scrollbar, but presented in Chrome). so we\n // allow the user to provide the scroll width before we work it out.\n getScrollbarWidth() {\n if (this.scrollbarWidth == null) {\n const useGridOptions = typeof this.gridOptions.scrollbarWidth === 'number' && this.gridOptions.scrollbarWidth >= 0;\n const scrollbarWidth = useGridOptions ? this.gridOptions.scrollbarWidth : getScrollbarWidth();\n if (scrollbarWidth != null) {\n this.scrollbarWidth = scrollbarWidth;\n this.eventService.dispatchEvent({\n type: Events.EVENT_SCROLLBAR_WIDTH_CHANGED\n });\n }\n }\n return this.scrollbarWidth;\n }\n isRowModelType(rowModelType) {\n return this.gridOptions.rowModelType === rowModelType ||\n (rowModelType === 'clientSide' && missing(this.gridOptions.rowModelType));\n }\n isDomLayout(domLayout) {\n var _a;\n const gridLayout = (_a = this.gridOptions.domLayout) !== null && _a !== void 0 ? _a : 'normal';\n return gridLayout === domLayout;\n }\n isRowSelection() {\n return this.gridOptions.rowSelection === 'single' || this.gridOptions.rowSelection === 'multiple';\n }\n useAsyncEvents() {\n return !this.is('suppressAsyncEvents');\n }\n isGetRowHeightFunction() {\n return typeof this.gridOptions.getRowHeight === 'function';\n }\n getRowHeightForNode(rowNode, allowEstimate = false, defaultRowHeight) {\n if (defaultRowHeight == null) {\n defaultRowHeight = this.environment.getDefaultRowHeight();\n }\n // check the function first, in case use set both function and\n // number, when using virtual pagination then function can be\n // used for pinned rows and the number for the body rows.\n if (this.isGetRowHeightFunction()) {\n if (allowEstimate) {\n return { height: defaultRowHeight, estimated: true };\n }\n const params = {\n node: rowNode,\n data: rowNode.data\n };\n const height = this.getCallback('getRowHeight')(params);\n if (this.isNumeric(height)) {\n if (height === 0) {\n doOnce(() => console.warn('AG Grid: The return of `getRowHeight` cannot be zero. If the intention is to hide rows, use a filter instead.'), 'invalidRowHeight');\n }\n return { height: Math.max(1, height), estimated: false };\n }\n }\n if (rowNode.detail && this.is('masterDetail')) {\n return this.getMasterDetailRowHeight();\n }\n const rowHeight = this.gridOptions.rowHeight && this.isNumeric(this.gridOptions.rowHeight) ? this.gridOptions.rowHeight : defaultRowHeight;\n return { height: rowHeight, estimated: false };\n }\n getMasterDetailRowHeight() {\n // if autoHeight, we want the height to grow to the new height starting at 1, as otherwise a flicker would happen,\n // as the detail goes to the default (eg 200px) and then immediately shrink up/down to the new measured height\n // (due to auto height) which looks bad, especially if doing row animation.\n if (this.is('detailRowAutoHeight')) {\n return { height: 1, estimated: false };\n }\n if (this.isNumeric(this.gridOptions.detailRowHeight)) {\n return { height: this.gridOptions.detailRowHeight, estimated: false };\n }\n return { height: 300, estimated: false };\n }\n // we don't allow dynamic row height for virtual paging\n getRowHeightAsNumber() {\n if (!this.gridOptions.rowHeight || missing(this.gridOptions.rowHeight)) {\n return this.environment.getDefaultRowHeight();\n }\n const rowHeight = this.gridOptions.rowHeight;\n if (rowHeight && this.isNumeric(rowHeight)) {\n this.environment.setRowHeightVariable(rowHeight);\n return rowHeight;\n }\n console.warn('AG Grid row height must be a number if not using standard row model');\n return this.environment.getDefaultRowHeight();\n }\n isNumeric(value) {\n return !isNaN(value) && typeof value === 'number' && isFinite(value);\n }\n getDomDataKey() {\n return this.domDataKey;\n }\n // returns the dom data, or undefined if not found\n getDomData(element, key) {\n const domData = element[this.getDomDataKey()];\n return domData ? domData[key] : undefined;\n }\n setDomData(element, key, value) {\n const domDataKey = this.getDomDataKey();\n let domData = element[domDataKey];\n if (missing(domData)) {\n domData = {};\n element[domDataKey] = domData;\n }\n domData[key] = value;\n }\n getDocument() {\n // if user is providing document, we use the users one,\n // otherwise we use the document on the global namespace.\n let result = null;\n if (this.gridOptions.getDocument && exists(this.gridOptions.getDocument)) {\n result = this.gridOptions.getDocument();\n }\n else if (this.eGridDiv) {\n result = this.eGridDiv.ownerDocument;\n }\n if (result && exists(result)) {\n return result;\n }\n return document;\n }\n getWindow() {\n const eDocument = this.getDocument();\n return eDocument.defaultView || window;\n }\n getRootNode() {\n return this.eGridDiv.getRootNode();\n }\n getAsyncTransactionWaitMillis() {\n return exists(this.gridOptions.asyncTransactionWaitMillis) ? this.gridOptions.asyncTransactionWaitMillis : 50;\n }\n isAnimateRows() {\n // never allow animating if enforcing the row order\n if (this.is('ensureDomOrder')) {\n return false;\n }\n return this.is('animateRows');\n }\n isGroupRowsSticky() {\n if (this.is('suppressGroupRowsSticky') ||\n this.is('paginateChildRows') ||\n this.is('groupHideOpenParents')) {\n return false;\n }\n return true;\n }\n isTreeData() {\n return this.is('treeData') && ModuleRegistry.__assertRegistered(ModuleNames.RowGroupingModule, 'Tree Data', this.api.getGridId());\n }\n isMasterDetail() {\n return this.is('masterDetail') && ModuleRegistry.__assertRegistered(ModuleNames.MasterDetailModule, 'masterDetail', this.api.getGridId());\n }\n isEnableRangeSelection() {\n return this.is('enableRangeSelection') && ModuleRegistry.__isRegistered(ModuleNames.RangeSelectionModule, this.api.getGridId());\n }\n isColumnsSortingCoupledToGroup() {\n const autoGroupColumnDef = this.gridOptions.autoGroupColumnDef;\n const isClientSideRowModel = this.isRowModelType('clientSide');\n return isClientSideRowModel && !(autoGroupColumnDef === null || autoGroupColumnDef === void 0 ? void 0 : autoGroupColumnDef.comparator) && !this.isTreeData();\n }\n getGroupAggFiltering() {\n const userValue = this.gridOptions.groupAggFiltering;\n if (typeof userValue === 'function') {\n return this.getCallback('groupAggFiltering');\n }\n if (isTrue(userValue)) {\n return () => true;\n }\n return undefined;\n }\n isGroupMultiAutoColumn() {\n if (this.gridOptions.groupDisplayType) {\n return matchesGroupDisplayType('multipleColumns', this.gridOptions.groupDisplayType);\n }\n // if we are doing hideOpenParents we also show multiple columns, otherwise hideOpenParents would not work\n return this.is('groupHideOpenParents');\n }\n isGroupUseEntireRow(pivotMode) {\n // we never allow groupDisplayType = 'groupRows' if in pivot mode, otherwise we won't see the pivot values.\n if (pivotMode) {\n return false;\n }\n return this.gridOptions.groupDisplayType ? matchesGroupDisplayType('groupRows', this.gridOptions.groupDisplayType) : false;\n }\n};\n__decorate([\n Autowired('gridOptions')\n], GridOptionsService.prototype, \"gridOptions\", void 0);\n__decorate([\n Autowired('eventService')\n], GridOptionsService.prototype, \"eventService\", void 0);\n__decorate([\n Autowired('environment')\n], GridOptionsService.prototype, \"environment\", void 0);\n__decorate([\n Autowired('eGridDiv')\n], GridOptionsService.prototype, \"eGridDiv\", void 0);\n__decorate([\n __param(0, Qualifier('gridApi')),\n __param(1, Qualifier('columnApi'))\n], GridOptionsService.prototype, \"agWire\", null);\n__decorate([\n PostConstruct\n], GridOptionsService.prototype, \"init\", null);\n__decorate([\n PreDestroy\n], GridOptionsService.prototype, \"destroy\", null);\nGridOptionsService = __decorate([\n Bean('gridOptionsService')\n], GridOptionsService);\nexport { GridOptionsService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean } from \"./context/context.mjs\";\nimport { BeanStub } from \"./context/beanStub.mjs\";\nlet LocaleService = class LocaleService extends BeanStub {\n getLocaleTextFunc() {\n const getLocaleText = this.gridOptionsService.getCallback('getLocaleText');\n if (getLocaleText) {\n //key: string, defaultValue: string, variableValues?: string[]\n return (key, defaultValue, variableValues) => {\n const params = {\n key,\n defaultValue,\n variableValues\n };\n return getLocaleText(params);\n };\n }\n const localeText = this.gridOptionsService.get('localeText');\n return (key, defaultValue, variableValues) => {\n let localisedText = localeText && localeText[key];\n if (localisedText && variableValues && variableValues.length) {\n let found = 0;\n while (true) {\n if (found >= variableValues.length) {\n break;\n }\n const idx = localisedText.indexOf('${variable}');\n if (idx === -1) {\n break;\n }\n localisedText = localisedText.replace('${variable}', variableValues[found++]);\n }\n }\n return localisedText !== null && localisedText !== void 0 ? localisedText : defaultValue;\n };\n }\n};\nLocaleService = __decorate([\n Bean('localeService')\n], LocaleService);\nexport { LocaleService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { PostConstruct } from \"../context/context.mjs\";\nimport { AbstractFakeScrollComp } from \"./abstractFakeScrollComp.mjs\";\nimport { isVisible, setFixedWidth } from \"../utils/dom.mjs\";\nimport { SetHeightFeature } from \"./rowContainer/setHeightFeature.mjs\";\nimport { Events } from \"../eventKeys.mjs\";\nexport class FakeVScrollComp extends AbstractFakeScrollComp {\n constructor() {\n super(FakeVScrollComp.TEMPLATE, 'vertical');\n }\n postConstruct() {\n super.postConstruct();\n this.createManagedBean(new SetHeightFeature(this.eContainer));\n this.ctrlsService.registerFakeVScrollComp(this);\n this.addManagedListener(this.eventService, Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED, this.onRowContainerHeightChanged.bind(this));\n }\n setScrollVisible() {\n const vScrollShowing = this.scrollVisibleService.isVerticalScrollShowing();\n const invisibleScrollbar = this.invisibleScrollbar;\n const scrollbarWidth = vScrollShowing ? (this.gridOptionsService.getScrollbarWidth() || 0) : 0;\n const adjustedScrollbarWidth = (scrollbarWidth === 0 && invisibleScrollbar) ? 16 : scrollbarWidth;\n this.addOrRemoveCssClass('ag-scrollbar-invisible', invisibleScrollbar);\n setFixedWidth(this.getGui(), adjustedScrollbarWidth);\n setFixedWidth(this.eViewport, adjustedScrollbarWidth);\n setFixedWidth(this.eContainer, adjustedScrollbarWidth);\n this.setDisplayed(vScrollShowing, { skipAriaHidden: true });\n }\n onRowContainerHeightChanged() {\n const gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();\n const gridBodyViewportEl = gridBodyCtrl.getBodyViewportElement();\n if (this.eViewport.scrollTop != gridBodyViewportEl.scrollTop) {\n this.eViewport.scrollTop = gridBodyViewportEl.scrollTop;\n }\n }\n getScrollPosition() {\n return this.getViewport().scrollTop;\n }\n setScrollPosition(value) {\n if (!isVisible(this.getViewport())) {\n this.attemptSettingScrollPosition(value);\n }\n this.getViewport().scrollTop = value;\n }\n}\nFakeVScrollComp.TEMPLATE = `
\n
\n
\n
\n
`;\n__decorate([\n PostConstruct\n], FakeVScrollComp.prototype, \"postConstruct\", null);\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Autowired, Bean, PostConstruct } from '../context/context.mjs';\nimport { BeanStub } from '../context/beanStub.mjs';\nimport { Events } from '../eventKeys.mjs';\nimport { getValueUsingField } from '../utils/object.mjs';\nimport { ModuleRegistry } from '../modules/moduleRegistry.mjs';\nimport { ModuleNames } from '../modules/moduleNames.mjs';\nimport { Column } from '../entities/column.mjs';\nimport { doOnce } from '../utils/function.mjs';\nimport { KeyCode } from '../constants/keyCode.mjs';\nimport { exists, toStringOrNull } from '../utils/generic.mjs';\nimport { parseDateTimeFromString, serialiseDate } from '../utils/date.mjs';\nconst MONTH_LOCALE_TEXT = {\n january: 'January',\n february: 'February',\n march: 'March',\n april: 'April',\n may: 'May',\n june: 'June',\n july: 'July',\n august: 'August',\n september: 'September',\n october: 'October',\n november: 'November',\n december: 'December'\n};\nconst MONTH_KEYS = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];\nlet DataTypeService = class DataTypeService extends BeanStub {\n constructor() {\n super(...arguments);\n this.dataTypeDefinitions = {};\n this.isWaitingForRowData = false;\n this.isColumnTypeOverrideInDataTypeDefinitions = false;\n // keep track of any column state updates whilst waiting for data types to be inferred\n this.columnStateUpdatesPendingInference = {};\n this.columnStateUpdateListenerDestroyFuncs = [];\n }\n init() {\n this.groupHideOpenParents = this.gridOptionsService.is('groupHideOpenParents');\n this.addManagedPropertyListener('groupHideOpenParents', () => {\n this.groupHideOpenParents = this.gridOptionsService.is('groupHideOpenParents');\n });\n this.processDataTypeDefinitions();\n this.addManagedPropertyListener('dataTypeDefinitions', () => {\n this.processDataTypeDefinitions();\n this.columnModel.recreateColumnDefs('gridOptionsChanged');\n });\n }\n processDataTypeDefinitions() {\n var _a;\n const defaultDataTypes = this.getDefaultDataTypes();\n this.dataTypeDefinitions = {};\n Object.entries(defaultDataTypes).forEach(([cellDataType, dataTypeDefinition]) => {\n this.dataTypeDefinitions[cellDataType] = Object.assign(Object.assign({}, dataTypeDefinition), { groupSafeValueFormatter: this.createGroupSafeValueFormatter(dataTypeDefinition) });\n });\n const dataTypeDefinitions = (_a = this.gridOptionsService.get('dataTypeDefinitions')) !== null && _a !== void 0 ? _a : {};\n this.dataTypeMatchers = {};\n Object.entries(dataTypeDefinitions).forEach(([cellDataType, dataTypeDefinition]) => {\n const mergedDataTypeDefinition = this.processDataTypeDefinition(dataTypeDefinition, dataTypeDefinitions, [cellDataType], defaultDataTypes);\n if (mergedDataTypeDefinition) {\n this.dataTypeDefinitions[cellDataType] = mergedDataTypeDefinition;\n if (dataTypeDefinition.dataTypeMatcher) {\n this.dataTypeMatchers[cellDataType] = dataTypeDefinition.dataTypeMatcher;\n }\n }\n });\n this.checkObjectValueHandlers(defaultDataTypes);\n ['dateString', 'text', 'number', 'boolean', 'date'].forEach((cellDataType) => {\n const overriddenDataTypeMatcher = this.dataTypeMatchers[cellDataType];\n if (overriddenDataTypeMatcher) {\n // remove to maintain correct ordering\n delete this.dataTypeMatchers[cellDataType];\n }\n this.dataTypeMatchers[cellDataType] = overriddenDataTypeMatcher !== null && overriddenDataTypeMatcher !== void 0 ? overriddenDataTypeMatcher : defaultDataTypes[cellDataType].dataTypeMatcher;\n });\n }\n mergeDataTypeDefinitions(parentDataTypeDefinition, childDataTypeDefinition) {\n const mergedDataTypeDefinition = Object.assign(Object.assign({}, parentDataTypeDefinition), childDataTypeDefinition);\n if (parentDataTypeDefinition.columnTypes &&\n childDataTypeDefinition.columnTypes &&\n childDataTypeDefinition.appendColumnTypes) {\n mergedDataTypeDefinition.columnTypes = [\n ...this.convertColumnTypes(parentDataTypeDefinition.columnTypes),\n ...this.convertColumnTypes(childDataTypeDefinition.columnTypes),\n ];\n }\n return mergedDataTypeDefinition;\n }\n processDataTypeDefinition(dataTypeDefinition, dataTypeDefinitions, alreadyProcessedDataTypes, defaultDataTypes) {\n let mergedDataTypeDefinition;\n const extendsCellDataType = dataTypeDefinition.extendsDataType;\n if (dataTypeDefinition.columnTypes) {\n this.isColumnTypeOverrideInDataTypeDefinitions = true;\n }\n if (dataTypeDefinition.extendsDataType === dataTypeDefinition.baseDataType) {\n const baseDataTypeDefinition = defaultDataTypes[extendsCellDataType];\n if (!this.validateDataTypeDefinition(dataTypeDefinition, baseDataTypeDefinition, extendsCellDataType)) {\n return undefined;\n }\n mergedDataTypeDefinition = this.mergeDataTypeDefinitions(baseDataTypeDefinition, dataTypeDefinition);\n }\n else {\n if (alreadyProcessedDataTypes.includes(extendsCellDataType)) {\n doOnce(() => console.warn('AG Grid: Data type definition hierarchies (via the \"extendsDataType\" property) cannot contain circular references.'), 'dataTypeExtendsCircularRef');\n return undefined;\n }\n const extendedDataTypeDefinition = dataTypeDefinitions[extendsCellDataType];\n if (!this.validateDataTypeDefinition(dataTypeDefinition, extendedDataTypeDefinition, extendsCellDataType)) {\n return undefined;\n }\n const mergedExtendedDataTypeDefinition = this.processDataTypeDefinition(extendedDataTypeDefinition, dataTypeDefinitions, [...alreadyProcessedDataTypes, extendsCellDataType], defaultDataTypes);\n if (!mergedExtendedDataTypeDefinition) {\n return undefined;\n }\n mergedDataTypeDefinition = this.mergeDataTypeDefinitions(mergedExtendedDataTypeDefinition, dataTypeDefinition);\n }\n return Object.assign(Object.assign({}, mergedDataTypeDefinition), { groupSafeValueFormatter: this.createGroupSafeValueFormatter(mergedDataTypeDefinition) });\n }\n validateDataTypeDefinition(dataTypeDefinition, parentDataTypeDefinition, parentCellDataType) {\n if (!parentDataTypeDefinition) {\n doOnce(() => console.warn(`AG Grid: The data type definition ${parentCellDataType} does not exist.`), 'dataTypeDefMissing' + parentCellDataType);\n return false;\n }\n if (parentDataTypeDefinition.baseDataType !== dataTypeDefinition.baseDataType) {\n doOnce(() => console.warn('AG Grid: The \"baseDataType\" property of a data type definition must match that of its parent.'), 'dataTypeBaseTypesMatch');\n return false;\n }\n return true;\n }\n createGroupSafeValueFormatter(dataTypeDefinition) {\n if (!dataTypeDefinition.valueFormatter) {\n return undefined;\n }\n return (params) => {\n var _a, _b;\n if ((_a = params.node) === null || _a === void 0 ? void 0 : _a.group) {\n const aggFunc = params.column.getAggFunc();\n if (aggFunc) {\n // the resulting type of these will be the same, so we call valueFormatter anyway\n if (aggFunc === 'first' || aggFunc === 'last') {\n return dataTypeDefinition.valueFormatter(params);\n }\n if (dataTypeDefinition.baseDataType === 'number' && aggFunc !== 'count') {\n if (typeof params.value === 'number') {\n return dataTypeDefinition.valueFormatter(params);\n }\n if (typeof params.value === 'object') {\n if (!params.value) {\n return undefined;\n }\n if ('toNumber' in params.value) {\n return dataTypeDefinition.valueFormatter(Object.assign(Object.assign({}, params), { value: params.value.toNumber() }));\n }\n if ('value' in params.value) {\n return dataTypeDefinition.valueFormatter(Object.assign(Object.assign({}, params), { value: params.value.value }));\n }\n }\n }\n }\n return undefined;\n }\n else if (this.groupHideOpenParents && params.column.isRowGroupActive()) {\n // `groupHideOpenParents` passes leaf values in the group column, so need to format still.\n // If it's not a string, we know it hasn't been formatted. Otherwise check the data type matcher.\n if (typeof params.value !== 'string' || ((_b = dataTypeDefinition.dataTypeMatcher) === null || _b === void 0 ? void 0 : _b.call(dataTypeDefinition, params.value))) {\n return dataTypeDefinition.valueFormatter(params);\n }\n return undefined;\n }\n return dataTypeDefinition.valueFormatter(params);\n };\n }\n updateColDefAndGetDataTypeDefinitionColumnType(colDef, userColDef, colId) {\n let { cellDataType } = userColDef;\n const { field } = userColDef;\n if (cellDataType === undefined) {\n cellDataType = colDef.cellDataType;\n }\n if ((cellDataType == null || cellDataType === true)) {\n cellDataType = this.canInferCellDataType(colDef, userColDef) ? this.inferCellDataType(field, colId) : false;\n }\n if (!cellDataType) {\n colDef.cellDataType = false;\n return undefined;\n }\n const dataTypeDefinition = this.dataTypeDefinitions[cellDataType];\n if (!dataTypeDefinition) {\n doOnce(() => console.warn(`AG Grid: Missing data type definition - \"${cellDataType}\"`), 'dataTypeMissing' + cellDataType);\n return undefined;\n }\n colDef.cellDataType = cellDataType;\n if (dataTypeDefinition.groupSafeValueFormatter) {\n colDef.valueFormatter = dataTypeDefinition.groupSafeValueFormatter;\n }\n if (dataTypeDefinition.valueParser) {\n colDef.valueParser = dataTypeDefinition.valueParser;\n }\n if (!dataTypeDefinition.suppressDefaultProperties) {\n this.setColDefPropertiesForBaseDataType(colDef, dataTypeDefinition, colId);\n }\n return dataTypeDefinition.columnTypes;\n }\n updateColDefAndGetColumnType(colDef, userColDef, colId) {\n var _a, _b;\n const dataTypeDefinitionColumnType = this.updateColDefAndGetDataTypeDefinitionColumnType(colDef, userColDef, colId);\n const columnTypes = (_b = (_a = userColDef.type) !== null && _a !== void 0 ? _a : dataTypeDefinitionColumnType) !== null && _b !== void 0 ? _b : colDef.type;\n colDef.type = columnTypes;\n return columnTypes ? this.convertColumnTypes(columnTypes) : undefined;\n }\n addColumnListeners(column) {\n if (!this.isWaitingForRowData) {\n return;\n }\n const columnStateUpdates = this.columnStateUpdatesPendingInference[column.getColId()];\n if (!columnStateUpdates) {\n return;\n }\n const columnListener = (event) => {\n columnStateUpdates.add(event.key);\n };\n column.addEventListener(Column.EVENT_STATE_UPDATED, columnListener);\n this.columnStateUpdateListenerDestroyFuncs.push(() => column.removeEventListener(Column.EVENT_STATE_UPDATED, columnListener));\n }\n canInferCellDataType(colDef, userColDef) {\n var _a;\n if (this.rowModel.getType() !== 'clientSide') {\n return false;\n }\n const propsToCheckForInference = { cellRenderer: true, valueGetter: true, valueParser: true, refData: true };\n if (this.doColDefPropsPreventInference(userColDef, propsToCheckForInference)) {\n return false;\n }\n const columnTypes = userColDef.type === null ? colDef.type : userColDef.type;\n if (columnTypes) {\n const columnTypeDefs = (_a = this.gridOptionsService.get('columnTypes')) !== null && _a !== void 0 ? _a : {};\n const hasPropsPreventingInference = this.convertColumnTypes(columnTypes).some(columnType => {\n const columnTypeDef = columnTypeDefs[columnType.trim()];\n return columnTypeDef && this.doColDefPropsPreventInference(columnTypeDef, propsToCheckForInference);\n });\n if (hasPropsPreventingInference) {\n return false;\n }\n }\n return !this.doColDefPropsPreventInference(colDef, propsToCheckForInference);\n }\n doColDefPropsPreventInference(colDef, propsToCheckForInference) {\n return [\n ['cellRenderer', 'agSparklineCellRenderer'], ['valueGetter', undefined], ['valueParser', undefined], ['refData', undefined]\n ].some(([prop, comparisonValue]) => this.doesColDefPropPreventInference(colDef, propsToCheckForInference, prop, comparisonValue));\n }\n doesColDefPropPreventInference(colDef, checkProps, prop, comparisonValue) {\n if (!checkProps[prop]) {\n return false;\n }\n const value = colDef[prop];\n if (value === null) {\n checkProps[prop] = false;\n return false;\n }\n else {\n return comparisonValue === undefined ? !!value : value === comparisonValue;\n }\n }\n inferCellDataType(field, colId) {\n var _a;\n if (!field) {\n return undefined;\n }\n let value;\n const initialData = this.getInitialData();\n if (initialData) {\n const fieldContainsDots = field.indexOf('.') >= 0 && !this.gridOptionsService.is('suppressFieldDotNotation');\n value = getValueUsingField(initialData, field, fieldContainsDots);\n }\n else {\n this.initWaitForRowData(colId);\n }\n if (value == null) {\n return undefined;\n }\n const [cellDataType] = (_a = Object.entries(this.dataTypeMatchers).find(([_cellDataType, dataTypeMatcher]) => dataTypeMatcher(value))) !== null && _a !== void 0 ? _a : ['object'];\n return cellDataType;\n }\n getInitialData() {\n const rowData = this.gridOptionsService.get('rowData');\n if (rowData === null || rowData === void 0 ? void 0 : rowData.length) {\n return rowData[0];\n }\n else if (this.initialData) {\n return this.initialData;\n }\n else {\n const rowNodes = this.rowModel\n .getRootNode()\n .allLeafChildren;\n if (rowNodes === null || rowNodes === void 0 ? void 0 : rowNodes.length) {\n return rowNodes[0].data;\n }\n }\n return null;\n }\n initWaitForRowData(colId) {\n this.columnStateUpdatesPendingInference[colId] = new Set();\n if (this.isWaitingForRowData) {\n return;\n }\n this.isWaitingForRowData = true;\n const columnTypeOverridesExist = this.isColumnTypeOverrideInDataTypeDefinitions;\n if (columnTypeOverridesExist) {\n this.columnModel.queueResizeOperations();\n }\n const destroyFunc = this.addManagedListener(this.eventService, Events.EVENT_ROW_DATA_UPDATE_STARTED, (event) => {\n const { firstRowData } = event;\n if (!firstRowData) {\n return;\n }\n destroyFunc === null || destroyFunc === void 0 ? void 0 : destroyFunc();\n this.isWaitingForRowData = false;\n this.processColumnsPendingInference(firstRowData, columnTypeOverridesExist);\n this.columnStateUpdatesPendingInference = {};\n if (columnTypeOverridesExist) {\n this.columnModel.processResizeOperations();\n }\n const dataTypesInferredEvent = {\n type: Events.EVENT_DATA_TYPES_INFERRED\n };\n this.eventService.dispatchEvent(dataTypesInferredEvent);\n });\n }\n isPendingInference() {\n return this.isWaitingForRowData;\n }\n processColumnsPendingInference(firstRowData, columnTypeOverridesExist) {\n this.initialData = firstRowData;\n const state = [];\n this.columnStateUpdateListenerDestroyFuncs.forEach(destroyFunc => destroyFunc());\n this.columnStateUpdateListenerDestroyFuncs = [];\n const newRowGroupColumnStateWithoutIndex = {};\n const newPivotColumnStateWithoutIndex = {};\n Object.entries(this.columnStateUpdatesPendingInference).forEach(([colId, columnStateUpdates]) => {\n const column = this.columnModel.getGridColumn(colId);\n if (!column) {\n return;\n }\n const oldColDef = column.getColDef();\n if (!this.columnModel.resetColumnDefIntoColumn(column)) {\n return;\n }\n const newColDef = column.getColDef();\n if (columnTypeOverridesExist && newColDef.type && newColDef.type !== oldColDef.type) {\n const updatedColumnState = this.getUpdatedColumnState(column, columnStateUpdates);\n if (updatedColumnState.rowGroup && updatedColumnState.rowGroupIndex == null) {\n newRowGroupColumnStateWithoutIndex[colId] = updatedColumnState;\n }\n if (updatedColumnState.pivot && updatedColumnState.pivotIndex == null) {\n newPivotColumnStateWithoutIndex[colId] = updatedColumnState;\n }\n state.push(updatedColumnState);\n }\n });\n if (columnTypeOverridesExist) {\n state.push(...this.columnModel.generateColumnStateForRowGroupAndPivotIndexes(newRowGroupColumnStateWithoutIndex, newPivotColumnStateWithoutIndex));\n }\n if (state.length) {\n this.columnModel.applyColumnState({ state }, 'cellDataTypeInferred');\n }\n this.initialData = null;\n }\n getUpdatedColumnState(column, columnStateUpdates) {\n const columnState = this.columnModel.getColumnStateFromColDef(column);\n columnStateUpdates.forEach(key => {\n // if the column state has been updated, don't update again\n delete columnState[key];\n if (key === 'rowGroup') {\n delete columnState.rowGroupIndex;\n }\n else if (key === 'pivot') {\n delete columnState.pivotIndex;\n }\n });\n return columnState;\n }\n checkObjectValueHandlers(defaultDataTypes) {\n const resolvedObjectDataTypeDefinition = this.dataTypeDefinitions.object;\n const defaultObjectDataTypeDefinition = defaultDataTypes.object;\n this.hasObjectValueParser = resolvedObjectDataTypeDefinition.valueParser !== defaultObjectDataTypeDefinition.valueParser;\n this.hasObjectValueFormatter = resolvedObjectDataTypeDefinition.valueFormatter !== defaultObjectDataTypeDefinition.valueFormatter;\n }\n convertColumnTypes(type) {\n let typeKeys = [];\n if (type instanceof Array) {\n const invalidArray = type.some((a) => typeof a !== 'string');\n if (invalidArray) {\n console.warn(\"AG Grid: if colDef.type is supplied an array it should be of type 'string[]'\");\n }\n else {\n typeKeys = type;\n }\n }\n else if (typeof type === 'string') {\n typeKeys = type.split(',');\n }\n else {\n console.warn(\"AG Grid: colDef.type should be of type 'string' | 'string[]'\");\n }\n return typeKeys;\n }\n getDateStringTypeDefinition() {\n return this.dataTypeDefinitions.dateString;\n }\n getDateParserFunction() {\n return this.getDateStringTypeDefinition().dateParser;\n }\n getDateFormatterFunction() {\n return this.getDateStringTypeDefinition().dateFormatter;\n }\n getDataTypeDefinition(column) {\n const colDef = column.getColDef();\n if (!colDef.cellDataType) {\n return undefined;\n }\n return this.dataTypeDefinitions[colDef.cellDataType];\n }\n getBaseDataType(column) {\n var _a;\n return (_a = this.getDataTypeDefinition(column)) === null || _a === void 0 ? void 0 : _a.baseDataType;\n }\n checkType(column, value) {\n var _a;\n if (value == null) {\n return true;\n }\n const dataTypeMatcher = (_a = this.getDataTypeDefinition(column)) === null || _a === void 0 ? void 0 : _a.dataTypeMatcher;\n if (!dataTypeMatcher) {\n return true;\n }\n return dataTypeMatcher(value);\n }\n validateColDef(colDef) {\n if (colDef.cellDataType === 'object') {\n if (colDef.valueFormatter === this.dataTypeDefinitions.object.groupSafeValueFormatter && !this.hasObjectValueFormatter) {\n doOnce(() => console.warn('AG Grid: Cell data type is \"object\" but no value formatter has been provided. Please either provide an object data type definition with a value formatter, or set \"colDef.valueFormatter\"'), 'dataTypeObjectValueFormatter');\n }\n if (colDef.editable && colDef.valueParser === this.dataTypeDefinitions.object.valueParser && !this.hasObjectValueParser) {\n doOnce(() => console.warn('AG Grid: Cell data type is \"object\" but no value parser has been provided. Please either provide an object data type definition with a value parser, or set \"colDef.valueParser\"'), 'dataTypeObjectValueParser');\n }\n }\n }\n setColDefPropertiesForBaseDataType(colDef, dataTypeDefinition, colId) {\n const formatValue = (column, node, value) => {\n let valueFormatter = column.getColDef().valueFormatter;\n if (valueFormatter === dataTypeDefinition.groupSafeValueFormatter) {\n valueFormatter = dataTypeDefinition.valueFormatter;\n }\n return this.valueFormatterService.formatValue(column, node, value, valueFormatter);\n };\n const usingSetFilter = ModuleRegistry.__isRegistered(ModuleNames.SetFilterModule, this.context.getGridId());\n const translate = this.localeService.getLocaleTextFunc();\n const mergeFilterParams = (params) => {\n const { filterParams } = colDef;\n colDef.filterParams = typeof filterParams === 'object' ? Object.assign(Object.assign({}, filterParams), params) : params;\n };\n colDef.useValueFormatterForExport = true;\n colDef.useValueParserForImport = true;\n switch (dataTypeDefinition.baseDataType) {\n case 'number': {\n colDef.cellEditor = 'agNumberCellEditor';\n if (usingSetFilter) {\n mergeFilterParams({\n comparator: (a, b) => {\n const valA = a == null ? 0 : parseInt(a);\n const valB = b == null ? 0 : parseInt(b);\n if (valA === valB)\n return 0;\n return valA > valB ? 1 : -1;\n },\n });\n }\n break;\n }\n case 'boolean': {\n colDef.cellEditor = 'agCheckboxCellEditor';\n colDef.cellRenderer = 'agCheckboxCellRenderer';\n colDef.suppressKeyboardEvent = (params) => !!params.colDef.editable && params.event.key === KeyCode.SPACE;\n if (usingSetFilter) {\n mergeFilterParams({\n valueFormatter: (params) => {\n if (!exists(params.value)) {\n return translate('blanks', '(Blanks)');\n }\n return translate(String(params.value), params.value ? 'True' : 'False');\n }\n });\n }\n else {\n mergeFilterParams({\n maxNumConditions: 1,\n filterOptions: [\n 'empty',\n {\n displayKey: 'true',\n displayName: 'True',\n predicate: (_filterValues, cellValue) => cellValue,\n numberOfInputs: 0,\n },\n {\n displayKey: 'false',\n displayName: 'False',\n predicate: (_filterValues, cellValue) => cellValue === false,\n numberOfInputs: 0,\n },\n ]\n });\n }\n break;\n }\n case 'date': {\n colDef.cellEditor = 'agDateCellEditor';\n colDef.keyCreator = (params) => formatValue(params.column, params.node, params.value);\n if (usingSetFilter) {\n mergeFilterParams({\n valueFormatter: (params) => {\n const valueFormatted = formatValue(params.column, params.node, params.value);\n return exists(valueFormatted) ? valueFormatted : translate('blanks', '(Blanks)');\n },\n treeList: true,\n treeListFormatter: (pathKey, level) => {\n if (level === 1 && pathKey != null) {\n const monthKey = MONTH_KEYS[Number(pathKey) - 1];\n return translate(monthKey, MONTH_LOCALE_TEXT[monthKey]);\n }\n return pathKey !== null && pathKey !== void 0 ? pathKey : translate('blanks', '(Blanks)');\n }\n });\n }\n break;\n }\n case 'dateString': {\n colDef.cellEditor = 'agDateStringCellEditor';\n colDef.keyCreator = (params) => formatValue(params.column, params.node, params.value);\n const convertToDate = this.getDateParserFunction();\n if (usingSetFilter) {\n mergeFilterParams({\n valueFormatter: (params) => {\n const valueFormatted = formatValue(params.column, params.node, params.value);\n return exists(valueFormatted) ? valueFormatted : translate('blanks', '(Blanks)');\n },\n treeList: true,\n treeListPathGetter: (value) => {\n const date = convertToDate(value !== null && value !== void 0 ? value : undefined);\n return date ? [String(date.getFullYear()), String(date.getMonth() + 1), String(date.getDate())] : null;\n },\n treeListFormatter: (pathKey, level) => {\n if (level === 1 && pathKey != null) {\n const monthKey = MONTH_KEYS[Number(pathKey) - 1];\n return translate(monthKey, MONTH_LOCALE_TEXT[monthKey]);\n }\n return pathKey !== null && pathKey !== void 0 ? pathKey : translate('blanks', '(Blanks)');\n }\n });\n }\n else {\n mergeFilterParams({\n comparator: (filterDate, cellValue) => {\n const cellAsDate = convertToDate(cellValue);\n if (cellValue == null || cellAsDate < filterDate) {\n return -1;\n }\n if (cellAsDate > filterDate) {\n return 1;\n }\n return 0;\n }\n });\n }\n break;\n }\n case 'object': {\n colDef.cellEditorParams = {\n useFormatter: true,\n };\n colDef.comparator = (a, b) => {\n const column = this.columnModel.getPrimaryColumn(colId);\n const colDef = column === null || column === void 0 ? void 0 : column.getColDef();\n if (!column || !colDef) {\n return 0;\n }\n const valA = a == null ? '' : formatValue(column, null, a);\n const valB = b == null ? '' : formatValue(column, null, b);\n if (valA === valB)\n return 0;\n return valA > valB ? 1 : -1;\n };\n colDef.keyCreator = (params) => formatValue(params.column, params.node, params.value);\n if (usingSetFilter) {\n mergeFilterParams({\n valueFormatter: (params) => {\n const valueFormatted = formatValue(params.column, params.node, params.value);\n return exists(valueFormatted) ? valueFormatted : translate('blanks', '(Blanks)');\n }\n });\n }\n else {\n colDef.filterValueGetter = (params) => formatValue(params.column, params.node, this.valueService.getValue(params.column, params.node));\n }\n break;\n }\n }\n }\n getDefaultDataTypes() {\n const defaultDateFormatMatcher = (value) => !!value.match('^\\\\d{4}-\\\\d{2}-\\\\d{2}$');\n const translate = this.localeService.getLocaleTextFunc();\n return {\n number: {\n baseDataType: 'number',\n valueParser: (params) => params.newValue === '' ? null : Number(params.newValue),\n valueFormatter: (params) => {\n if (params.value == null) {\n return '';\n }\n if (typeof params.value !== 'number' || isNaN(params.value)) {\n return translate('invalidNumber', 'Invalid Number');\n }\n return String(params.value);\n },\n dataTypeMatcher: (value) => typeof value === 'number',\n },\n text: {\n baseDataType: 'text',\n valueParser: (params) => params.newValue === '' ? null : toStringOrNull(params.newValue),\n dataTypeMatcher: (value) => typeof value === 'string',\n },\n boolean: {\n baseDataType: 'boolean',\n valueParser: (params) => params.newValue === '' ? null : String(params.newValue).toLowerCase() === 'true',\n valueFormatter: (params) => params.value == null ? '' : String(params.value),\n dataTypeMatcher: (value) => typeof value === 'boolean',\n },\n date: {\n baseDataType: 'date',\n valueParser: (params) => parseDateTimeFromString(params.newValue == null ? null : String(params.newValue)),\n valueFormatter: (params) => {\n var _a;\n if (params.value == null) {\n return '';\n }\n if (!(params.value instanceof Date) || isNaN(params.value.getTime())) {\n return translate('invalidDate', 'Invalid Date');\n }\n return (_a = serialiseDate(params.value, false)) !== null && _a !== void 0 ? _a : '';\n },\n dataTypeMatcher: (value) => value instanceof Date,\n },\n dateString: {\n baseDataType: 'dateString',\n dateParser: (value) => { var _a; return (_a = parseDateTimeFromString(value)) !== null && _a !== void 0 ? _a : undefined; },\n dateFormatter: (value) => { var _a; return (_a = serialiseDate(value !== null && value !== void 0 ? value : null, false)) !== null && _a !== void 0 ? _a : undefined; },\n valueParser: (params) => defaultDateFormatMatcher(String(params.newValue)) ? params.newValue : null,\n valueFormatter: (params) => defaultDateFormatMatcher(String(params.value)) ? params.value : '',\n dataTypeMatcher: (value) => typeof value === 'string' && defaultDateFormatMatcher(value),\n },\n object: {\n baseDataType: 'object',\n valueParser: () => null,\n valueFormatter: (params) => { var _a; return (_a = toStringOrNull(params.value)) !== null && _a !== void 0 ? _a : ''; },\n }\n };\n }\n};\n__decorate([\n Autowired('rowModel')\n], DataTypeService.prototype, \"rowModel\", void 0);\n__decorate([\n Autowired('columnModel')\n], DataTypeService.prototype, \"columnModel\", void 0);\n__decorate([\n Autowired('columnUtils')\n], DataTypeService.prototype, \"columnUtils\", void 0);\n__decorate([\n Autowired('valueService')\n], DataTypeService.prototype, \"valueService\", void 0);\n__decorate([\n Autowired('valueFormatterService')\n], DataTypeService.prototype, \"valueFormatterService\", void 0);\n__decorate([\n PostConstruct\n], DataTypeService.prototype, \"init\", null);\nDataTypeService = __decorate([\n Bean('dataTypeService')\n], DataTypeService);\nexport { DataTypeService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Bean, Autowired } from '../context/context.mjs';\nimport { BeanStub } from '../context/beanStub.mjs';\nimport { exists } from '../utils/generic.mjs';\nlet ValueParserService = class ValueParserService extends BeanStub {\n parseValue(column, rowNode, newValue, oldValue) {\n const colDef = column.getColDef();\n const params = {\n node: rowNode,\n data: rowNode === null || rowNode === void 0 ? void 0 : rowNode.data,\n oldValue,\n newValue,\n colDef,\n column,\n api: this.gridOptionsService.api,\n columnApi: this.gridOptionsService.columnApi,\n context: this.gridOptionsService.context\n };\n const valueParser = colDef.valueParser;\n if (exists(valueParser)) {\n if (typeof valueParser === 'function') {\n return valueParser(params);\n }\n return this.expressionService.evaluate(valueParser, params);\n }\n return newValue;\n }\n};\n__decorate([\n Autowired('expressionService')\n], ValueParserService.prototype, \"expressionService\", void 0);\nValueParserService = __decorate([\n Bean('valueParserService')\n], ValueParserService);\nexport { ValueParserService };\n","import { SelectionService } from \"./selectionService.mjs\";\nimport { ColumnApi } from \"./columns/columnApi.mjs\";\nimport { ColumnModel } from \"./columns/columnModel.mjs\";\nimport { RowRenderer } from \"./rendering/rowRenderer.mjs\";\nimport { GridHeaderComp } from \"./headerRendering/gridHeaderComp.mjs\";\nimport { FilterManager } from \"./filter/filterManager.mjs\";\nimport { ValueService } from \"./valueService/valueService.mjs\";\nimport { EventService } from \"./eventService.mjs\";\nimport { GridBodyComp } from \"./gridBodyComp/gridBodyComp.mjs\";\nimport { GridApi } from \"./gridApi.mjs\";\nimport { ColumnFactory } from \"./columns/columnFactory.mjs\";\nimport { DisplayedGroupCreator } from \"./columns/displayedGroupCreator.mjs\";\nimport { ExpressionService } from \"./valueService/expressionService.mjs\";\nimport { TemplateService } from \"./templateService.mjs\";\nimport { PopupService } from \"./widgets/popupService.mjs\";\nimport { Logger, LoggerFactory } from \"./logger.mjs\";\nimport { ColumnUtils } from \"./columns/columnUtils.mjs\";\nimport { AutoWidthCalculator } from \"./rendering/autoWidthCalculator.mjs\";\nimport { HorizontalResizeService } from \"./headerRendering/common/horizontalResizeService.mjs\";\nimport { Context } from \"./context/context.mjs\";\nimport { GridComp } from \"./gridComp/gridComp.mjs\";\nimport { DragAndDropService } from \"./dragAndDrop/dragAndDropService.mjs\";\nimport { DragService } from \"./dragAndDrop/dragService.mjs\";\nimport { SortController } from \"./sortController.mjs\";\nimport { FocusService } from \"./focusService.mjs\";\nimport { MouseEventService } from \"./gridBodyComp/mouseEventService.mjs\";\nimport { CellNavigationService } from \"./cellNavigationService.mjs\";\nimport { Events } from \"./events.mjs\";\nimport { ValueFormatterService } from \"./rendering/valueFormatterService.mjs\";\nimport { AgCheckbox } from \"./widgets/agCheckbox.mjs\";\nimport { AgRadioButton } from \"./widgets/agRadioButton.mjs\";\nimport { VanillaFrameworkOverrides } from \"./vanillaFrameworkOverrides.mjs\";\nimport { ScrollVisibleService } from \"./gridBodyComp/scrollVisibleService.mjs\";\nimport { StylingService } from \"./styling/stylingService.mjs\";\nimport { ColumnHoverService } from \"./rendering/columnHoverService.mjs\";\nimport { ColumnAnimationService } from \"./rendering/columnAnimationService.mjs\";\nimport { AutoGroupColService } from \"./columns/autoGroupColService.mjs\";\nimport { PaginationProxy } from \"./pagination/paginationProxy.mjs\";\nimport { PaginationAutoPageSizeService } from \"./pagination/paginationAutoPageSizeService.mjs\";\nimport { ValueCache } from \"./valueService/valueCache.mjs\";\nimport { ChangeDetectionService } from \"./valueService/changeDetectionService.mjs\";\nimport { AlignedGridsService } from \"./alignedGridsService.mjs\";\nimport { UserComponentFactory } from \"./components/framework/userComponentFactory.mjs\";\nimport { UserComponentRegistry } from \"./components/framework/userComponentRegistry.mjs\";\nimport { AgComponentUtils } from \"./components/framework/agComponentUtils.mjs\";\nimport { ComponentMetadataProvider } from \"./components/framework/componentMetadataProvider.mjs\";\nimport { Beans } from \"./rendering/beans.mjs\";\nimport { Environment } from \"./environment.mjs\";\nimport { AnimationFrameService } from \"./misc/animationFrameService.mjs\";\nimport { NavigationService } from \"./gridBodyComp/navigationService.mjs\";\nimport { RowContainerHeightService } from \"./rendering/rowContainerHeightService.mjs\";\nimport { SelectableService } from \"./rowNodes/selectableService.mjs\";\nimport { PaginationComp } from \"./pagination/paginationComp.mjs\";\nimport { ResizeObserverService } from \"./misc/resizeObserverService.mjs\";\nimport { OverlayWrapperComponent } from \"./rendering/overlays/overlayWrapperComponent.mjs\";\nimport { AgGroupComponent } from \"./widgets/agGroupComponent.mjs\";\nimport { AgDialog } from \"./widgets/agDialog.mjs\";\nimport { AgPanel } from \"./widgets/agPanel.mjs\";\nimport { AgInputTextField } from \"./widgets/agInputTextField.mjs\";\nimport { AgInputTextArea } from \"./widgets/agInputTextArea.mjs\";\nimport { AgSlider } from \"./widgets/agSlider.mjs\";\nimport { AgInputNumberField } from \"./widgets/agInputNumberField.mjs\";\nimport { AgInputRange } from \"./widgets/agInputRange.mjs\";\nimport { AgSelect } from \"./widgets/agSelect.mjs\";\nimport { AgRichSelect } from \"./widgets/agRichSelect.mjs\";\nimport { AgToggleButton } from \"./widgets/agToggleButton.mjs\";\nimport { RowPositionUtils } from \"./entities/rowPositionUtils.mjs\";\nimport { CellPositionUtils } from \"./entities/cellPositionUtils.mjs\";\nimport { PinnedRowModel } from \"./pinnedRowModel/pinnedRowModel.mjs\";\nimport { ModuleRegistry } from \"./modules/moduleRegistry.mjs\";\nimport { ModuleNames } from \"./modules/moduleNames.mjs\";\nimport { UndoRedoService } from \"./undoRedo/undoRedoService.mjs\";\nimport { AgStackComponentsRegistry } from \"./components/agStackComponentsRegistry.mjs\";\nimport { HeaderPositionUtils } from \"./headerRendering/common/headerPosition.mjs\";\nimport { HeaderNavigationService } from \"./headerRendering/common/headerNavigationService.mjs\";\nimport { missing } from \"./utils/generic.mjs\";\nimport { ColumnDefFactory } from \"./columns/columnDefFactory.mjs\";\nimport { RowCssClassCalculator } from \"./rendering/row/rowCssClassCalculator.mjs\";\nimport { RowNodeBlockLoader } from \"./rowNodeCache/rowNodeBlockLoader.mjs\";\nimport { RowNodeSorter } from \"./rowNodes/rowNodeSorter.mjs\";\nimport { CtrlsService } from \"./ctrlsService.mjs\";\nimport { CtrlsFactory } from \"./ctrlsFactory.mjs\";\nimport { FakeHScrollComp } from \"./gridBodyComp/fakeHScrollComp.mjs\";\nimport { PinnedWidthService } from \"./gridBodyComp/pinnedWidthService.mjs\";\nimport { RowContainerComp } from \"./gridBodyComp/rowContainer/rowContainerComp.mjs\";\nimport { RowNodeEventThrottle } from \"./entities/rowNodeEventThrottle.mjs\";\nimport { StandardMenuFactory } from \"./headerRendering/cells/column/standardMenu.mjs\";\nimport { SortIndicatorComp } from \"./headerRendering/cells/column/sortIndicatorComp.mjs\";\nimport { GridOptionsService } from \"./gridOptionsService.mjs\";\nimport { LocaleService } from \"./localeService.mjs\";\nimport { GridOptionsValidator } from \"./gridOptionsValidator.mjs\";\nimport { FakeVScrollComp } from \"./gridBodyComp/fakeVScrollComp.mjs\";\nimport { DataTypeService } from \"./columns/dataTypeService.mjs\";\nimport { AgInputDateField } from \"./widgets/agInputDateField.mjs\";\nimport { ValueParserService } from \"./valueService/valueParserService.mjs\";\nimport { AgAutocomplete } from \"./widgets/agAutocomplete.mjs\";\n// creates JavaScript vanilla Grid, including JavaScript (ag-stack) components, which can\n// be wrapped by the framework wrappers\nexport class Grid {\n constructor(eGridDiv, gridOptions, params) {\n if (!gridOptions) {\n console.error('AG Grid: no gridOptions provided to the grid');\n return;\n }\n this.gridOptions = gridOptions;\n new GridCoreCreator().create(eGridDiv, gridOptions, context => {\n const gridComp = new GridComp(eGridDiv);\n context.createBean(gridComp);\n }, undefined, params);\n }\n destroy() {\n if (this.gridOptions && this.gridOptions.api) {\n this.gridOptions.api.destroy();\n }\n }\n}\nlet nextGridId = 1;\n// created services of grid only, no UI, so frameworks can use this if providing\n// their own UI\nexport class GridCoreCreator {\n create(eGridDiv, gridOptions, createUi, acceptChanges, params) {\n var _a;\n const debug = !!gridOptions.debug;\n const gridId = (_a = gridOptions.gridId) !== null && _a !== void 0 ? _a : String(nextGridId++);\n const registeredModules = this.getRegisteredModules(params, gridId);\n const beanClasses = this.createBeansList(gridOptions.rowModelType, registeredModules, gridId);\n const providedBeanInstances = this.createProvidedBeans(eGridDiv, gridOptions, params);\n if (!beanClasses) {\n return;\n } // happens when no row model found\n const contextParams = {\n providedBeanInstances: providedBeanInstances,\n beanClasses: beanClasses,\n debug: debug,\n gridId: gridId,\n };\n const logger = new Logger('AG Grid', () => gridOptions.debug);\n const contextLogger = new Logger('Context', () => contextParams.debug);\n const context = new Context(contextParams, contextLogger);\n const beans = context.getBean('beans');\n this.registerModuleUserComponents(beans, registeredModules);\n this.registerStackComponents(beans, registeredModules);\n this.registerControllers(beans, registeredModules);\n createUi(context);\n // we wait until the UI has finished initialising before setting in columns and rows\n beans.ctrlsService.whenReady(() => {\n this.setColumnsAndData(beans);\n this.dispatchGridReadyEvent(beans);\n const isEnterprise = ModuleRegistry.__isRegistered(ModuleNames.EnterpriseCoreModule, gridId);\n logger.log(`initialised successfully, enterprise = ${isEnterprise}`);\n });\n if (acceptChanges) {\n acceptChanges(context);\n }\n }\n registerControllers(beans, registeredModules) {\n registeredModules.forEach(module => {\n if (module.controllers) {\n module.controllers.forEach(meta => beans.ctrlsFactory.register(meta));\n }\n });\n }\n registerStackComponents(beans, registeredModules) {\n const agStackComponents = this.createAgStackComponentsList(registeredModules);\n beans.agStackComponentsRegistry.setupComponents(agStackComponents);\n }\n getRegisteredModules(params, gridId) {\n const passedViaConstructor = params ? params.modules : null;\n const registered = ModuleRegistry.__getRegisteredModules(gridId);\n const allModules = [];\n const mapNames = {};\n // adds to list and removes duplicates\n const addModule = (moduleBased, mod, gridId) => {\n const addIndividualModule = (currentModule) => {\n if (!mapNames[currentModule.moduleName]) {\n mapNames[currentModule.moduleName] = true;\n allModules.push(currentModule);\n ModuleRegistry.__register(currentModule, moduleBased, gridId);\n }\n };\n addIndividualModule(mod);\n if (mod.dependantModules) {\n mod.dependantModules.forEach(m => addModule(moduleBased, m, gridId));\n }\n };\n if (passedViaConstructor) {\n passedViaConstructor.forEach(m => addModule(true, m, gridId));\n }\n if (registered) {\n registered.forEach(m => addModule(!ModuleRegistry.__isPackageBased(), m, undefined));\n }\n return allModules;\n }\n registerModuleUserComponents(beans, registeredModules) {\n const moduleUserComps = this.extractModuleEntity(registeredModules, (module) => module.userComponents ? module.userComponents : []);\n moduleUserComps.forEach(compMeta => {\n beans.userComponentRegistry.registerDefaultComponent(compMeta.componentName, compMeta.componentClass);\n });\n }\n createProvidedBeans(eGridDiv, gridOptions, params) {\n let frameworkOverrides = params ? params.frameworkOverrides : null;\n if (missing(frameworkOverrides)) {\n frameworkOverrides = new VanillaFrameworkOverrides();\n }\n const seed = {\n gridOptions: gridOptions,\n eGridDiv: eGridDiv,\n globalEventListener: params ? params.globalEventListener : null,\n frameworkOverrides: frameworkOverrides\n };\n if (params && params.providedBeanInstances) {\n Object.assign(seed, params.providedBeanInstances);\n }\n return seed;\n }\n createAgStackComponentsList(registeredModules) {\n let components = [\n { componentName: 'AgCheckbox', componentClass: AgCheckbox },\n { componentName: 'AgRadioButton', componentClass: AgRadioButton },\n { componentName: 'AgToggleButton', componentClass: AgToggleButton },\n { componentName: 'AgInputTextField', componentClass: AgInputTextField },\n { componentName: 'AgInputTextArea', componentClass: AgInputTextArea },\n { componentName: 'AgInputNumberField', componentClass: AgInputNumberField },\n { componentName: 'AgInputDateField', componentClass: AgInputDateField },\n { componentName: 'AgInputRange', componentClass: AgInputRange },\n { componentName: 'AgRichSelect', componentClass: AgRichSelect },\n { componentName: 'AgSelect', componentClass: AgSelect },\n { componentName: 'AgSlider', componentClass: AgSlider },\n { componentName: 'AgGridBody', componentClass: GridBodyComp },\n { componentName: 'AgHeaderRoot', componentClass: GridHeaderComp },\n { componentName: 'AgSortIndicator', componentClass: SortIndicatorComp },\n { componentName: 'AgPagination', componentClass: PaginationComp },\n { componentName: 'AgOverlayWrapper', componentClass: OverlayWrapperComponent },\n { componentName: 'AgGroupComponent', componentClass: AgGroupComponent },\n { componentName: 'AgPanel', componentClass: AgPanel },\n { componentName: 'AgDialog', componentClass: AgDialog },\n { componentName: 'AgRowContainer', componentClass: RowContainerComp },\n { componentName: 'AgFakeHorizontalScroll', componentClass: FakeHScrollComp },\n { componentName: 'AgFakeVerticalScroll', componentClass: FakeVScrollComp },\n { componentName: 'AgAutocomplete', componentClass: AgAutocomplete },\n ];\n const moduleAgStackComps = this.extractModuleEntity(registeredModules, (module) => module.agStackComponents ? module.agStackComponents : []);\n components = components.concat(moduleAgStackComps);\n return components;\n }\n createBeansList(rowModelType = 'clientSide', registeredModules, gridId) {\n // only load beans matching the required row model\n const rowModelModules = registeredModules.filter(module => !module.rowModel || module.rowModel === rowModelType);\n // assert that the relevant module has been loaded\n const rowModelModuleNames = {\n clientSide: ModuleNames.ClientSideRowModelModule,\n infinite: ModuleNames.InfiniteRowModelModule,\n serverSide: ModuleNames.ServerSideRowModelModule,\n viewport: ModuleNames.ViewportRowModelModule\n };\n if (!rowModelModuleNames[rowModelType]) {\n console.error('AG Grid: could not find row model for rowModelType = ' + rowModelType);\n return;\n }\n if (!ModuleRegistry.__assertRegistered(rowModelModuleNames[rowModelType], `rowModelType = '${rowModelType}'`, gridId)) {\n return;\n }\n // beans should only contain SERVICES, it should NEVER contain COMPONENTS\n const beans = [\n Beans, RowPositionUtils, CellPositionUtils, HeaderPositionUtils,\n PaginationAutoPageSizeService, GridApi, UserComponentRegistry, AgComponentUtils,\n ComponentMetadataProvider, ResizeObserverService, UserComponentFactory,\n RowContainerHeightService, HorizontalResizeService, LocaleService, GridOptionsValidator,\n PinnedRowModel, DragService, DisplayedGroupCreator, EventService, GridOptionsService,\n PopupService, SelectionService, FilterManager, ColumnModel, HeaderNavigationService,\n PaginationProxy, RowRenderer, ExpressionService, ColumnFactory, TemplateService,\n AlignedGridsService, NavigationService, ValueCache, ValueService, LoggerFactory,\n ColumnUtils, AutoWidthCalculator, StandardMenuFactory, DragAndDropService, ColumnApi,\n FocusService, MouseEventService, Environment, CellNavigationService, ValueFormatterService,\n StylingService, ScrollVisibleService, SortController, ColumnHoverService, ColumnAnimationService,\n SelectableService, AutoGroupColService, ChangeDetectionService, AnimationFrameService,\n UndoRedoService, AgStackComponentsRegistry, ColumnDefFactory,\n RowCssClassCalculator, RowNodeBlockLoader, RowNodeSorter, CtrlsService,\n PinnedWidthService, RowNodeEventThrottle, CtrlsFactory, DataTypeService, ValueParserService\n ];\n const moduleBeans = this.extractModuleEntity(rowModelModules, (module) => module.beans ? module.beans : []);\n beans.push(...moduleBeans);\n // check for duplicates, as different modules could include the same beans that\n // they depend on, eg ClientSideRowModel in enterprise, and ClientSideRowModel in community\n const beansNoDuplicates = [];\n beans.forEach(bean => {\n if (beansNoDuplicates.indexOf(bean) < 0) {\n beansNoDuplicates.push(bean);\n }\n });\n return beansNoDuplicates;\n }\n extractModuleEntity(moduleEntities, extractor) {\n return [].concat(...moduleEntities.map(extractor));\n }\n setColumnsAndData(beans) {\n const columnDefs = beans.gridOptionsService.get('columnDefs');\n beans.columnModel.setColumnDefs(columnDefs || [], \"gridInitializing\");\n beans.rowModel.start();\n }\n dispatchGridReadyEvent(beans) {\n const readyEvent = {\n type: Events.EVENT_GRID_READY,\n };\n beans.eventService.dispatchEvent(readyEvent);\n }\n}\n","export class BaseComponentWrapper {\n wrap(OriginalConstructor, mandatoryMethodList, optionalMethodList = [], componentType) {\n const wrapper = this.createWrapper(OriginalConstructor, componentType);\n mandatoryMethodList.forEach((methodName => {\n this.createMethod(wrapper, methodName, true);\n }));\n optionalMethodList.forEach((methodName => {\n this.createMethod(wrapper, methodName, false);\n }));\n return wrapper;\n }\n unwrap(comp) {\n return comp;\n }\n createMethod(wrapper, methodName, mandatory) {\n wrapper.addMethod(methodName, this.createMethodProxy(wrapper, methodName, mandatory));\n }\n createMethodProxy(wrapper, methodName, mandatory) {\n return function () {\n if (wrapper.hasMethod(methodName)) {\n return wrapper.callMethod(methodName, arguments);\n }\n if (mandatory) {\n console.warn('AG Grid: Framework component is missing the method ' + methodName + '()');\n }\n return null;\n };\n }\n}\n","export var BarColumnLabelPlacement;\n(function (BarColumnLabelPlacement) {\n BarColumnLabelPlacement[\"InsideBase\"] = \"insideBase\";\n BarColumnLabelPlacement[\"InsideEnd\"] = \"insideEnd\";\n BarColumnLabelPlacement[\"Center\"] = \"center\";\n BarColumnLabelPlacement[\"OutsideEnd\"] = \"outsideEnd\";\n})(BarColumnLabelPlacement || (BarColumnLabelPlacement = {}));\n","/**\n * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue\n * @version v30.1.0\n * @link https://www.ag-grid.com/\n * @license MIT\n */\nconst globalObj = typeof global === 'undefined' ? {} : global;\nglobalObj.HTMLElement = typeof HTMLElement === 'undefined' ? {} : HTMLElement;\nglobalObj.HTMLButtonElement = typeof HTMLButtonElement === 'undefined' ? {} : HTMLButtonElement;\nglobalObj.HTMLSelectElement = typeof HTMLSelectElement === 'undefined' ? {} : HTMLSelectElement;\nglobalObj.HTMLInputElement = typeof HTMLInputElement === 'undefined' ? {} : HTMLInputElement;\nglobalObj.Node = typeof Node === 'undefined' ? {} : Node;\nglobalObj.MouseEvent = typeof MouseEvent === 'undefined' ? {} : MouseEvent;\n// columns\nexport { ColumnFactory } from \"./columns/columnFactory.mjs\";\nexport { ColumnModel } from \"./columns/columnModel.mjs\";\nexport { ColumnKeyCreator } from \"./columns/columnKeyCreator.mjs\";\nexport { ColumnUtils } from \"./columns/columnUtils.mjs\";\nexport { DisplayedGroupCreator } from \"./columns/displayedGroupCreator.mjs\";\nexport { GroupInstanceIdCreator } from \"./columns/groupInstanceIdCreator.mjs\";\nexport { GROUP_AUTO_COLUMN_ID } from \"./columns/autoGroupColService.mjs\";\n// components\nexport { ComponentUtil } from \"./components/componentUtil.mjs\";\nexport { AgStackComponentsRegistry } from \"./components/agStackComponentsRegistry.mjs\";\nexport { UserComponentRegistry } from \"./components/framework/userComponentRegistry.mjs\";\nexport { UserComponentFactory } from \"./components/framework/userComponentFactory.mjs\";\nexport { ColDefUtil } from \"./components/colDefUtil.mjs\";\n// context\nexport { BeanStub } from \"./context/beanStub.mjs\";\nexport { Context, Autowired, PostConstruct, PreConstruct, Optional, Bean, Qualifier, PreDestroy } from \"./context/context.mjs\";\nexport { QuerySelector, RefSelector } from \"./widgets/componentAnnotations.mjs\";\n// excel\nexport { ExcelFactoryMode } from \"./interfaces/iExcelCreator.mjs\";\n// dragAndDrop\nexport { DragAndDropService, DragSourceType, HorizontalDirection, VerticalDirection } from \"./dragAndDrop/dragAndDropService.mjs\";\nexport { DragService } from \"./dragAndDrop/dragService.mjs\";\n// entities\nexport { Column } from \"./entities/column.mjs\";\nexport { ColumnGroup } from \"./entities/columnGroup.mjs\";\nexport { ProvidedColumnGroup } from \"./entities/providedColumnGroup.mjs\";\nexport { RowNode } from \"./entities/rowNode.mjs\";\nexport { RowHighlightPosition } from \"./interfaces/iRowNode.mjs\";\nexport { FilterManager } from \"./filter/filterManager.mjs\";\nexport { ProvidedFilter } from \"./filter/provided/providedFilter.mjs\";\nexport { SimpleFilter } from \"./filter/provided/simpleFilter.mjs\";\nexport { ScalarFilter } from \"./filter/provided/scalarFilter.mjs\";\nexport { NumberFilter } from \"./filter/provided/number/numberFilter.mjs\";\nexport { TextFilter } from \"./filter/provided/text/textFilter.mjs\";\nexport { DateFilter } from \"./filter/provided/date/dateFilter.mjs\";\nexport { TextFloatingFilter } from './filter/provided/text/textFloatingFilter.mjs';\nexport { HeaderFilterCellComp } from './headerRendering/cells/floatingFilter/headerFilterCellComp.mjs';\nexport { FloatingFilterMapper } from './filter/floating/floatingFilterMapper.mjs';\n// gridPanel\nexport { GridBodyComp } from \"./gridBodyComp/gridBodyComp.mjs\";\nexport { GridBodyCtrl, RowAnimationCssClasses } from \"./gridBodyComp/gridBodyCtrl.mjs\";\nexport { ScrollVisibleService } from \"./gridBodyComp/scrollVisibleService.mjs\";\nexport { MouseEventService } from \"./gridBodyComp/mouseEventService.mjs\";\nexport { NavigationService } from \"./gridBodyComp/navigationService.mjs\";\n// rowContainer\nexport { RowContainerComp } from \"./gridBodyComp/rowContainer/rowContainerComp.mjs\";\nexport { RowContainerName, RowContainerCtrl, RowContainerType, getRowContainerTypeForName } from \"./gridBodyComp/rowContainer/rowContainerCtrl.mjs\";\n// headerRendering\nexport { BodyDropPivotTarget } from \"./headerRendering/columnDrag/bodyDropPivotTarget.mjs\";\nexport { BodyDropTarget } from \"./headerRendering/columnDrag/bodyDropTarget.mjs\";\nexport { CssClassApplier } from \"./headerRendering/cells/cssClassApplier.mjs\";\nexport { HeaderRowContainerComp } from \"./headerRendering/rowContainer/headerRowContainerComp.mjs\";\nexport { GridHeaderComp } from \"./headerRendering/gridHeaderComp.mjs\";\nexport { GridHeaderCtrl } from \"./headerRendering/gridHeaderCtrl.mjs\";\nexport { HeaderRowComp, HeaderRowType } from \"./headerRendering/row/headerRowComp.mjs\";\nexport { HeaderRowCtrl } from \"./headerRendering/row/headerRowCtrl.mjs\";\nexport { HeaderCellCtrl } from \"./headerRendering/cells/column/headerCellCtrl.mjs\";\nexport { SortIndicatorComp } from \"./headerRendering/cells/column/sortIndicatorComp.mjs\";\nexport { HeaderFilterCellCtrl } from \"./headerRendering/cells/floatingFilter/headerFilterCellCtrl.mjs\";\nexport { HeaderGroupCellCtrl } from \"./headerRendering/cells/columnGroup/headerGroupCellCtrl.mjs\";\nexport { AbstractHeaderCellCtrl } from \"./headerRendering/cells/abstractCell/abstractHeaderCellCtrl.mjs\";\nexport { HeaderRowContainerCtrl } from \"./headerRendering/rowContainer/headerRowContainerCtrl.mjs\";\nexport { HorizontalResizeService } from \"./headerRendering/common/horizontalResizeService.mjs\";\nexport { MoveColumnFeature } from \"./headerRendering/columnDrag/moveColumnFeature.mjs\";\nexport { StandardMenuFactory } from \"./headerRendering/cells/column/standardMenu.mjs\";\n// layout\nexport { TabbedLayout } from \"./layout/tabbedLayout.mjs\";\n// misc\nexport { simpleHttpRequest } from \"./misc/simpleHttpRequest.mjs\";\nexport { ResizeObserverService } from \"./misc/resizeObserverService.mjs\";\nexport { AnimationFrameService } from \"./misc/animationFrameService.mjs\";\nexport { LargeTextCellEditor } from \"./rendering/cellEditors/largeTextCellEditor.mjs\";\nexport { PopupEditorWrapper } from \"./rendering/cellEditors/popupEditorWrapper.mjs\";\nexport { SelectCellEditor } from \"./rendering/cellEditors/selectCellEditor.mjs\";\nexport { TextCellEditor } from \"./rendering/cellEditors/textCellEditor.mjs\";\nexport { NumberCellEditor } from \"./rendering/cellEditors/numberCellEditor.mjs\";\nexport { DateCellEditor } from \"./rendering/cellEditors/dateCellEditor.mjs\";\nexport { DateStringCellEditor } from \"./rendering/cellEditors/dateStringCellEditor.mjs\";\nexport { CheckboxCellEditor } from \"./rendering/cellEditors/checkboxCellEditor.mjs\";\n// rendering / cellRenderers\nexport { Beans } from \"./rendering/beans.mjs\";\nexport { AnimateShowChangeCellRenderer } from \"./rendering/cellRenderers/animateShowChangeCellRenderer.mjs\";\nexport { AnimateSlideCellRenderer } from \"./rendering/cellRenderers/animateSlideCellRenderer.mjs\";\nexport { GroupCellRenderer, } from \"./rendering/cellRenderers/groupCellRenderer.mjs\";\nexport { GroupCellRendererCtrl } from \"./rendering/cellRenderers/groupCellRendererCtrl.mjs\";\n// features\nexport { SetLeftFeature } from \"./rendering/features/setLeftFeature.mjs\";\nexport { PositionableFeature } from \"./rendering/features/positionableFeature.mjs\";\n// rendering\nexport { AutoWidthCalculator } from \"./rendering/autoWidthCalculator.mjs\";\nexport { CheckboxSelectionComponent } from \"./rendering/checkboxSelectionComponent.mjs\";\nexport { CellComp } from \"./rendering/cell/cellComp.mjs\";\nexport { CellCtrl } from \"./rendering/cell/cellCtrl.mjs\";\nexport { RowCtrl } from \"./rendering/row/rowCtrl.mjs\";\nexport { RowRenderer } from \"./rendering/rowRenderer.mjs\";\nexport { ValueFormatterService } from \"./rendering/valueFormatterService.mjs\";\nexport { CssClassManager } from \"./rendering/cssClassManager.mjs\";\nexport { CheckboxCellRenderer } from \"./rendering/cellRenderers/checkboxCellRenderer.mjs\";\n// row models\nexport { PinnedRowModel } from \"./pinnedRowModel/pinnedRowModel.mjs\";\nexport { ServerSideTransactionResultStatus } from \"./interfaces/serverSideTransaction.mjs\";\nexport { ChangedPath } from \"./utils/changedPath.mjs\";\nexport { RowNodeBlock } from \"./rowNodeCache/rowNodeBlock.mjs\";\nexport { RowNodeBlockLoader } from \"./rowNodeCache/rowNodeBlockLoader.mjs\";\nexport { PaginationProxy } from \"./pagination/paginationProxy.mjs\";\nexport { ClientSideRowModelSteps } from \"./interfaces/iClientSideRowModel.mjs\";\n//styling\nexport { StylingService } from \"./styling/stylingService.mjs\";\nexport { LayoutCssClasses } from \"./styling/layoutFeature.mjs\";\n// widgets\nexport { AgAbstractField } from \"./widgets/agAbstractField.mjs\";\nexport { AgCheckbox } from \"./widgets/agCheckbox.mjs\";\nexport { AgRadioButton } from \"./widgets/agRadioButton.mjs\";\nexport { AgToggleButton } from \"./widgets/agToggleButton.mjs\";\nexport { AgInputTextField } from \"./widgets/agInputTextField.mjs\";\nexport { AgInputTextArea } from \"./widgets/agInputTextArea.mjs\";\nexport { AgInputNumberField } from \"./widgets/agInputNumberField.mjs\";\nexport { AgInputDateField } from \"./widgets/agInputDateField.mjs\";\nexport { AgInputRange } from \"./widgets/agInputRange.mjs\";\nexport { AgRichSelect } from \"./widgets/agRichSelect.mjs\";\nexport { AgSelect } from \"./widgets/agSelect.mjs\";\nexport { AgSlider } from \"./widgets/agSlider.mjs\";\nexport { AgGroupComponent } from \"./widgets/agGroupComponent.mjs\";\nexport { AgMenuItemComponent } from \"./widgets/agMenuItemComponent.mjs\";\nexport { AgMenuList } from \"./widgets/agMenuList.mjs\";\nexport { AgMenuPanel } from \"./widgets/agMenuPanel.mjs\";\nexport { AgDialog } from \"./widgets/agDialog.mjs\";\nexport { AgPanel } from \"./widgets/agPanel.mjs\";\nexport { Component } from \"./widgets/component.mjs\";\nexport { ManagedFocusFeature } from \"./widgets/managedFocusFeature.mjs\";\nexport { TabGuardComp } from \"./widgets/tabGuardComp.mjs\";\nexport { TabGuardCtrl, TabGuardClassNames } from \"./widgets/tabGuardCtrl.mjs\";\nexport { PopupComponent } from \"./widgets/popupComponent.mjs\";\nexport { PopupService } from \"./widgets/popupService.mjs\";\nexport { TouchListener } from \"./widgets/touchListener.mjs\";\nexport { VirtualList } from \"./widgets/virtualList.mjs\";\nexport { AgAbstractLabel } from \"./widgets/agAbstractLabel.mjs\";\nexport { AgPickerField } from \"./widgets/agPickerField.mjs\";\nexport { AgAutocomplete } from \"./widgets/agAutocomplete.mjs\";\n// range\nexport { CellRangeType, SelectionHandleType } from \"./interfaces/IRangeService.mjs\";\n// root\nexport { AutoScrollService } from './autoScrollService.mjs';\nexport { VanillaFrameworkOverrides } from \"./vanillaFrameworkOverrides.mjs\";\nexport { CellNavigationService } from \"./cellNavigationService.mjs\";\nexport { AlignedGridsService } from \"./alignedGridsService.mjs\";\nexport { KeyCode } from \"./constants/keyCode.mjs\";\nexport { Grid, GridCoreCreator } from \"./grid.mjs\";\nexport { GridApi } from \"./gridApi.mjs\";\nexport { Events } from \"./eventKeys.mjs\";\nexport { FocusService } from \"./focusService.mjs\";\nexport { GridOptionsService } from \"./gridOptionsService.mjs\";\nexport { EventService } from \"./eventService.mjs\";\nexport { SelectableService } from \"./rowNodes/selectableService.mjs\";\nexport { RowNodeSorter } from \"./rowNodes/rowNodeSorter.mjs\";\nexport { CtrlsService } from \"./ctrlsService.mjs\";\nexport { GridComp } from \"./gridComp/gridComp.mjs\";\nexport { GridCtrl } from \"./gridComp/gridCtrl.mjs\";\nexport { Logger, LoggerFactory } from \"./logger.mjs\";\nexport { SortController } from \"./sortController.mjs\";\nexport { TemplateService } from \"./templateService.mjs\";\nexport { LocaleService } from './localeService.mjs';\nexport * from \"./utils/index.mjs\"; // please leave this as is - we want it to be explicit for build reasons\nexport { ValueService } from \"./valueService/valueService.mjs\";\nexport { ValueCache } from \"./valueService/valueCache.mjs\";\nexport { ExpressionService } from \"./valueService/expressionService.mjs\";\nexport { ValueParserService } from \"./valueService/valueParserService.mjs\";\nexport { CellPositionUtils } from \"./entities/cellPositionUtils.mjs\";\nexport { RowPositionUtils } from \"./entities/rowPositionUtils.mjs\";\nexport { HeaderPositionUtils } from \"./headerRendering/common/headerPosition.mjs\";\nexport { HeaderNavigationService, HeaderNavigationDirection } from \"./headerRendering/common/headerNavigationService.mjs\";\nexport { DataTypeService } from \"./columns/dataTypeService.mjs\";\nexport * from \"./propertyKeys.mjs\";\nexport { ColumnApi } from \"./columns/columnApi.mjs\";\nexport { BaseComponentWrapper } from \"./components/framework/frameworkComponentWrapper.mjs\";\nexport { Environment } from \"./environment.mjs\";\nexport { CustomTooltipFeature } from \"./widgets/customTooltipFeature.mjs\";\n// charts\nexport * from \"./interfaces/iChartOptions.mjs\";\nexport * from \"./interfaces/iAgChartOptions.mjs\";\n// sparklines\nexport * from \"./interfaces/iSparklineCellRendererParams.mjs\";\nexport { ModuleNames } from \"./modules/moduleNames.mjs\";\nexport { ModuleRegistry } from \"./modules/moduleRegistry.mjs\";\n// events\nexport * from \"./events.mjs\";\n","// @ag-grid-community/react v30.1.0\nclass BaseReactComponent {\n}\nexport class ReactComponent extends BaseReactComponent {\n constructor(reactComponent, portalManager, componentType) {\n super();\n this.portal = null;\n this.reactComponent = reactComponent;\n this.portalManager = portalManager;\n this.componentType = componentType;\n this.statelessComponent = this.isStateless(this.reactComponent);\n }\n getGui() {\n return this.eParentElement;\n }\n destroy() {\n if (this.componentInstance && typeof this.componentInstance.destroy == 'function') {\n this.componentInstance.destroy();\n }\n return this.portalManager.destroyPortal(this.portal);\n }\n createParentElement(params) {\n const componentWrappingElement = this.portalManager.getComponentWrappingElement();\n const eParentElement = document.createElement(componentWrappingElement || 'div');\n eParentElement.classList.add('ag-react-container');\n // DEPRECATED - use componentInstance.getReactContainerStyle or componentInstance.getReactContainerClasses instead\n // so user can have access to the react container, to add css class or style\n params.reactContainer = eParentElement;\n return eParentElement;\n }\n addParentContainerStyleAndClasses() {\n if (!this.componentInstance) {\n return;\n }\n if (this.componentInstance.getReactContainerStyle && this.componentInstance.getReactContainerStyle()) {\n Object.assign(this.eParentElement.style, this.componentInstance.getReactContainerStyle());\n }\n if (this.componentInstance.getReactContainerClasses && this.componentInstance.getReactContainerClasses()) {\n const parentContainerClasses = this.componentInstance.getReactContainerClasses();\n parentContainerClasses.forEach(className => this.eParentElement.classList.add(className));\n }\n }\n statelessComponentRendered() {\n // fixed fragmentsFuncRendererCreateDestroy funcRendererWithNan (changeDetectionService too for NaN)\n return this.eParentElement.childElementCount > 0 || this.eParentElement.childNodes.length > 0;\n }\n getFrameworkComponentInstance() {\n return this.componentInstance;\n }\n isStatelessComponent() {\n return this.statelessComponent;\n }\n getReactComponentName() {\n return this.reactComponent.name;\n }\n getMemoType() {\n return this.hasSymbol() ? Symbol.for('react.memo') : 0xead3;\n }\n hasSymbol() {\n return typeof Symbol === 'function' && Symbol.for;\n }\n isStateless(Component) {\n return (typeof Component === 'function' && !(Component.prototype && Component.prototype.isReactComponent))\n || (typeof Component === 'object' && Component.$$typeof === this.getMemoType());\n }\n hasMethod(name) {\n const frameworkComponentInstance = this.getFrameworkComponentInstance();\n return (!!frameworkComponentInstance && frameworkComponentInstance[name] !== null) ||\n this.fallbackMethodAvailable(name);\n }\n callMethod(name, args) {\n const frameworkComponentInstance = this.getFrameworkComponentInstance();\n if (this.isStatelessComponent()) {\n return this.fallbackMethod(name, !!args && args[0] ? args[0] : {});\n }\n else if (!(!!frameworkComponentInstance)) {\n // instance not ready yet - wait for it\n setTimeout(() => this.callMethod(name, args));\n return;\n }\n const method = frameworkComponentInstance[name];\n if (!!method) {\n return method.apply(frameworkComponentInstance, args);\n }\n if (this.fallbackMethodAvailable(name)) {\n return this.fallbackMethod(name, !!args && args[0] ? args[0] : {});\n }\n }\n addMethod(name, callback) {\n this[name] = callback;\n }\n}\n","/**\n * @license React\n * react-dom-server-legacy.browser.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its 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'use strict';var aa=require(\"react\");function l(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;c